Skip to content

Commit

Permalink
Disable "snippets" expansion in Jedi LSP (#21194)
Browse files Browse the repository at this point in the history
This brings the Jedi based completion experience in line with that
provided by Pylance. Completions now insert only the current symbol
rather than assuming that the user wants to e.g: call that symbol.

This means for example that completing `max` will insert just `max`
rather `max(arg1, arg2)`. While for this case this may be seen as less
useful, it means that insertions in places where a call is not desired
(such as imports and typing contexts) will not be forced to manually
remove the parentheses and template arguments which might otherwise be
inserted.

Users can still use the signature support UI to explore signatures and
of course insertion of an opening parenthesis will still insert a
closing one.

Hopefully this new configuration will be preferable to a majority of
users.

I've done some light testing to check that this disables the described
additional completion, however I'm not massively familiar with JediLSP
so I'm not sure what other behaviours this will disable.

Fixes #15858
  • Loading branch information
PeterJCLaw authored May 9, 2023
1 parent a85eb3b commit 8d291f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/activation/jedi/analysisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class JediLanguageServerAnalysisOptions extends LanguageServerAnalysisOpt
markupKindPreferred: 'markdown',
completion: {
resolveEagerly: false,
disableSnippets: false,
disableSnippets: true,
},
diagnostics: {
enable: true,
Expand Down
2 changes: 1 addition & 1 deletion src/test/activation/jedi/jediAnalysisOptions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ suite('Jedi LSP - analysis Options', () => {

expect(result.initializationOptions.markupKindPreferred).to.deep.equal('markdown');
expect(result.initializationOptions.completion.resolveEagerly).to.deep.equal(false);
expect(result.initializationOptions.completion.disableSnippets).to.deep.equal(false);
expect(result.initializationOptions.completion.disableSnippets).to.deep.equal(true);
expect(result.initializationOptions.diagnostics.enable).to.deep.equal(true);
expect(result.initializationOptions.diagnostics.didOpen).to.deep.equal(true);
expect(result.initializationOptions.diagnostics.didSave).to.deep.equal(true);
Expand Down

0 comments on commit 8d291f7

Please sign in to comment.