-
Notifications
You must be signed in to change notification settings - Fork 679
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
Feature nullability #5400
Feature nullability #5400
Conversation
And also fix bug where fix all might be applied to the wrong editor
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.
You've made such great progress. Thanks for the contribution.
@@ -1188,17 +1188,20 @@ | |||
{ | |||
"command": "o.fixAll.solution", | |||
"title": "Fix all occurrences of a code issue within solution", | |||
"category": "OmniSharp" | |||
"category": "OmniSharp", | |||
"enablement": "editorFocus" |
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.
Thanks, this is a nice change.
@@ -119,18 +119,20 @@ export default class OmnisharpCompletionProvider extends AbstractProvider implem | |||
return; | |||
} | |||
|
|||
const responseLine = response.Line; | |||
const responseColumn = response.Column; | |||
const editor = window.visibleTextEditors.find(editor => editor.document === document); |
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.
This seems like a bug fix. Did you run into issues with this during development?
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.
I actually caught it via TS warning that window.activeTextEditor
could be undefined! Though I can definitely see the bug occurring during normal development.
export async function reAnalyze(server: OmniSharpServer, request: any) { | ||
return server.makeRequest<any>(protocol.Requests.ReAnalyze, request); | ||
export async function reAnalyze(server: OmniSharpServer, request: protocol.ReAnalyzeRequest) { | ||
return server.makeRequest<protocol.ReAnalyzeReponse>(protocol.Requests.ReAnalyze, request); |
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.
Thanks for this fix.
Note: I'm aware of #5276 and that the feature/ folder may well become obsolete in the near future.
Nevertheless, given there's no set timeline yet, I figure the sooner strict mode can be turned on globally, the better, and I also got to learn some new TypeScript tricks along the way (like type guards).
Note that none of these changes have been validated on an actual codebase.
A good chunk of the fixes fall into one of two buckets: a) simply explicitly returning undefined (or an empty array) when we have nothing to return to VS Code or b) reducing a
has
check on a Map followed by aget
to justget
and then a check against undefined.Otherwise:
Impact:
Brings strict errors down to 234 from 377 when compared to master @ 9336244.
(If we ignore tests, the number of violations goes down further to just 40, 27 of which are in folders I haven't looked at yet.)