-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Support LSP based completion provider #243528
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
src/vs/workbench/contrib/terminalContrib/suggest/browser/lspTerminalModelContentProvider.ts
Outdated
Show resolved
Hide resolved
TODO: activate language extension (python extensions, pylance) if installed when user types 'python' in terminal TODO: Need to figure out way to save successful commands in the virtual file so we get the correct completions in future prompts. |
…ictionaryService. Lots of TODOs
src/vs/workbench/contrib/terminalContrib/suggest/browser/lspCompletionProviderAddon.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminal.suggest.contribution.ts
Outdated
Show resolved
Hide resolved
@@ -82,7 +84,8 @@ export class CommandDetectionCapability extends Disposable implements ICommandDe | |||
|
|||
constructor( | |||
private readonly _terminal: Terminal, | |||
@ILogService private readonly _logService: ILogService | |||
@ILogService private readonly _logService: ILogService, | |||
@ILspTerminalDictionaryService private readonly _lspTerminalDictionaryService: ILspTerminalDictionaryService, |
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 don't think we want to inject this service here. Can you describe why this is needed? It would be best to encapsulate all lsp stuff in the provider addon.
src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminal.suggest.contribution.ts
Outdated
Show resolved
Hide resolved
src/vs/platform/terminal/common/capabilities/lspTerminalDictionaryService.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
Outdated
Show resolved
Hide resolved
} | ||
|
||
if ( | ||
this._ctx.instance.shellType !== GeneralShellType.Python && |
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.
could we create consts for all of these strings and keep them in lsp files? python
, py
, and ms-python...
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.
Great idea, just resolved this here: 58e810f
Also I removed check for this._ctx.instance.shellLaunchConfig.executable
since it seems like its never Python but always upper shell. this._ctx.shellType
would be enough check.
src/vs/workbench/contrib/terminalContrib/suggest/browser/lspCompletionProviderAddon.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/lspTerminalModelContentProvider.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminal.suggest.contribution.ts
Outdated
Show resolved
Hide resolved
...rkbench/contrib/terminalContrib/suggest/test/browser/lspTerminalModelContentProvider.test.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/test/browser/terminalCompletionModel.test.ts
Show resolved
Hide 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.
Looks good, getting close!
I created this one file called lspTerminalUtil which basically contains all the const used for terminal-lsp related stuff. |
Resolves: #241167
Resolves: microsoft/vscode-python#24776
Note: I left several TODOs for when we eventually make this more generic (not too specific for Python)