-   Notifications  You must be signed in to change notification settings 
- Fork 1.3k
First steps in autocomplete #5601
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
Conversation
|  | ||
| @injectable() | ||
| export class LanguageServer implements ILanguageServer { | ||
| private readonly startupCompleted: Deferred<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.
@DonJayamme if you could take a look at this part, that'd be great. I think making this all a singleton makes sense. But not entirely sure.
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 think the LanguageServer was effectively a singleton before (as it's only created by the LanguageServerManager)
In reply to: 283065695 [](ancestors = 283065695)
| } | ||
|  | ||
| // Force the colors to the defaults | ||
| return null; | 
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.
More of a question here. Why null for functions like this? As far as I'd seen the general though was always using undefined versus null unless specifically required by an external API. Want to make sure that we are both coding with the right concept of null versus undefined. #WontFix
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.
VSCode and Typescript compiler have a general undefined over null rule that they mostly stick to.
In reply to: 283067624 [](ancestors = 283067624)
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 think it's because some of the apis I was using were returning null colors.
In reply to: 283067624 [](ancestors = 283067624)
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.
Yeah not sure vscode returns undefined. I think they actually return null for a lot of stuff. At least the completion stuff did. I think 'null' means no value returned, as opposed to not sure if the function was called or not.
In reply to: 283067802 [](ancestors = 283067802,283067624)
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.
Yeah this says the same thing:
 https://basarat.gitbooks.io/typescript/docs/javascript/null-undefined.html
Null and Undefined
 Free youtube video on the subject
 JavaScript (and by extension TypeScript) has two bottom types : null and undefined. They are intended to mean different things:
 Something hasn't been initialized : undefined.
 Something is currently unavailable: null.
In reply to: 283067961 [](ancestors = 283067961,283067802,283067624)
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.
If the APIs return it that's enough of a reason for me no need to change. Sounds like (in the second link) some VSCode folks want only undefined and some want to use it like the link you posted.
 https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#null-and-undefined
 microsoft/vscode#70020
In reply to: 283068106 [](ancestors = 283068106,283067961,283067802,283067624)
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.
Here's another example:
node_modules\vscode-languageserver-protocol\lib\protocol.d.ts
returns '| null' on just about everything. There's no '| undefined' anywhere.
In reply to: 283068106 [](ancestors = 283068106,283067961,283067802,283067624)
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.
Oh it's DOM apis that return null. Looks like that's the root of where it comes from.
In reply to: 283068385 [](ancestors = 283068385,283068106,283067961,283067802,283067624)
| // https://github.com/Microsoft/vscode/blob/master/src/vs/editor/standalone/common/themes.ts#L13 | ||
| private generateMonacoThemeObject(args: IApplyThemeArgs) : monacoEditor.editor.IStandaloneThemeData { | ||
| const result: monacoEditor.editor.IStandaloneThemeData = { | ||
| base: args.isDark ? 'vs-dark' : 'vs', | 
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.
Isn't it vs-light for the light theme? #Resolved
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.
Not in monaco. See this as an example:
 https://microsoft.github.io/monaco-editor/playground.html#customizing-the-appearence-exposed-colors
In reply to: 283069004 [](ancestors = 283069004)
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.
Or this:
 https://microsoft.github.io/monaco-editor/api/modules/monaco.editor.html#builtintheme
In reply to: 283069188 [](ancestors = 283069188,283069004)
| if (args.baseColors) { | ||
| const keys = Object.keys(args.baseColors); | ||
| keys.forEach(k => { | ||
| const color = args.baseColors && args.baseColors[k] ? args.baseColors[k] : '#000000'; | 
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.
args.baseColors [](start = 30, length = 15)
Already checked at if #WontFix
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 theme may include others. If so we need to combine the two together | ||
| const include = theme ? theme.include : undefined; | ||
| if (include && include !== null) { | 
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.
null should already be falsy. #Resolved
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.
| // Should be somewhere under currentPath/resources/app/extensions inside of a json file | ||
| let extensionsPath = path.join(currentPath, 'resources', 'app', 'extensions'); | ||
| if (!(await fs.pathExists(extensionsPath))) { | ||
| // Might be on mac or linux. try a different path | 
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.
Don't we have an IsWindows that we use other places? #WontFix
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.
Yes, we do. But it still needs to check the first path I think.
In reply to: 283071695 [](ancestors = 283071695)
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 guess I'd feel more comfortable checking both.
In reply to: 283071819 [](ancestors = 283071819,283071695)
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.
| incomplete: list.isIncomplete | ||
| }; | ||
| } else { | ||
| const array = result as vscodeLanguageClient.CompletionItem[]; | 
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.
If the result is a vscode.CompletionItem[] or vscode.CompletionList don't they both get cast as the array here? Or do they have the same property isIncomplete for the completion item and the completion list as the vscodeLanguageClient items? If so a comment would be nice to specify that. #Resolved
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.
Yes vscode.CompletionList and vcodeLanguageClient.CompletionList both have the isIncomplete property. This else should only come through here if the result is one of the two array types.
I'll add a comment to that effect.
In reply to: 283921359 [](ancestors = 283921359)
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 this is a good catch since one of those types isIncomplete is an optional parameter. It should be checking for 'items' instead.
In reply to: 283922093 [](ancestors = 283922093,283921359)
| 
 This is the history for this file in vscode: Refers to: resources/MagicPython.tmLanguage.json:2 in cfefcf0. [](commit_id = cfefcf0, deletion_comment = False) | 
| private submitContent = () => { | ||
| let content = this.getContents(); | ||
| if (content) { | ||
| // Remove empty lines off the end | 
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 it make sense to trim leading new lines as well? #WontFix
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.
Maybe? I thought after was less obvious it was there so the user might not have intended it. On the front they did. But not sure why they'd want them. They just make the output cell bigger. Maybe somebody might do that on purpose though? Although I guess you could still achieve the same thing with a comment and bunch of space.
In reply to: 283932962 [](ancestors = 283932962)
| { | ||
| comments: { | ||
| lineComment: '#', | ||
| blockComment: ['\'\'\'', '\'\'\''] | 
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.
doc comments are ''' or """ #Resolved
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.
These actually didn't seem to be used. I'll change it and see what happens. I think the tokenizer takes precedence.
In reply to: 283936732 [](ancestors = 283936732)
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.

For #5342
Rewire everything to use monaco and provide suggestions and hover support. Just use the base language server for now (jedi or dotnetcore)
package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed)