-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Set python.pythonPath in workspace/configuration LSP call #11084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set python.pythonPath in workspace/configuration LSP call #11084
Conversation
That code smell is confusing; TS on my machine could not collapse: Thenable<any[]>
| Thenable<ResponseError<void>>
| Thenable<any[] | ResponseError<void>> Into: Thenable<any[] | ResponseError<void>> Hence the redundant cast. But, somehow sonar's analysis is able to do so? If I drop the cast, I get:
|
bf7c49d
to
e298a27
Compare
Codecov Report
@@ Coverage Diff @@
## master #11084 +/- ##
==========================================
- Coverage 61.42% 61.41% -0.01%
==========================================
Files 597 597
Lines 32756 32822 +66
Branches 4631 4645 +14
==========================================
+ Hits 20121 20159 +38
- Misses 11619 11645 +26
- Partials 1016 1018 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise.
token: CancellationToken, | ||
next: ConfigurationRequest.HandlerSignature | ||
): HandlerResult<any[], void> => { | ||
const result = next(params, token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const result = next(params, token); | |
const result = next(params, token) as any[] | ResponseError<void> | Thenable<any[] | ResponseError<void>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this help with the code smell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, though I would really be interested in why there's a difference between Sonar and what we run locally, as doing this cast early throws away the safety of everything I've written... @DonJayamanne any clue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, TS is happy if I change the type on result
's decl rather than casting, so I'll just do that. If they change HandlerResult
, then there's no cast to prevent detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments as to why you'd be getting the compilation errors
Solution - return the original value of result
. I.e. in the function addPythonPath
return the argument as the return value.
const addPytonPath = (settings:....) => {
if (!(settings instanceof ResponseError)) {
....
}
return settings;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing that (and dropping my hand-written type) doesn't change things:
Note the squiggle on then
, as I'm still getting the message as written in #11084 (comment).
Meanwhile, Sonar's TS install has no problem with the original code I wrote if I were to drop the hand-written types entirely.
SonarCloud Quality Gate failed.
|
For #11083
Has telemetry for enhancements.Unit tests & system/integration tests are added/updated.(Not sure I can even test this; if I have LS in a test there's not a way for me to simulate a call without a real server to do it, which means mocking RPC.)Test plan is updated as appropriate.package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).The wiki is updated with any design decisions/details.