Merge pull request #316 from kiteco/more-python-completions

This commit is contained in:
Daniel Hung 2020-08-05 11:39:27 -07:00 committed by GitHub
commit 831a2108a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -7,8 +7,13 @@ const EVENT_SUPPORT = (fileName) => {
}; };
const COMPLETIONS_SUPPORT = [ const COMPLETIONS_SUPPORT = [
{ pattern: "**/*.{py,go,js,jsx,vue}", scheme: "file" }, { pattern: "**/*.{go,js,jsx,vue}", scheme: "file" },
{ pattern: "**/*.{py,go,js,jsx,vue}", scheme: "untitled" } { pattern: "**/*.{go,js,jsx,vue}", scheme: "untitled" }
];
const FULL_COMPLETIONS_SUPPORT = [
{ pattern: "**/*.{py}", scheme: "file" },
{ pattern: "**/*.{py}", scheme: "untitled" }
]; ];
const DEFINITIONS_SUPPORT = [ const DEFINITIONS_SUPPORT = [
@ -60,6 +65,7 @@ module.exports = {
INTERVAL, INTERVAL,
EVENT_SUPPORT, EVENT_SUPPORT,
COMPLETIONS_SUPPORT, COMPLETIONS_SUPPORT,
FULL_COMPLETIONS_SUPPORT,
DEFINITIONS_SUPPORT, DEFINITIONS_SUPPORT,
HOVER_SUPPORT, HOVER_SUPPORT,
SIGNATURES_SUPPORT, SIGNATURES_SUPPORT,

View File

@ -10,6 +10,7 @@ const {
ERROR_COLOR, ERROR_COLOR,
EVENT_SUPPORT, EVENT_SUPPORT,
COMPLETIONS_SUPPORT, COMPLETIONS_SUPPORT,
FULL_COMPLETIONS_SUPPORT,
DEFINITIONS_SUPPORT, DEFINITIONS_SUPPORT,
HOVER_SUPPORT, HOVER_SUPPORT,
SIGNATURES_SUPPORT, SIGNATURES_SUPPORT,
@ -120,6 +121,16 @@ const Kite = {
new KiteCompletionProvider(Kite, completionsTriggers, optionalCompletionsTriggers), ...completionsTriggers.concat(optionalCompletionsTriggers)) new KiteCompletionProvider(Kite, completionsTriggers, optionalCompletionsTriggers), ...completionsTriggers.concat(optionalCompletionsTriggers))
); );
// More triggers for Python because we have semantic completions.
// We leave out open quotes because we can't suggest string constants.
var pythonCompletionsTriggers = ['.', ',', ' ', '(', '[', '{', '='];
this.disposables.push(
vscode.languages.registerCompletionItemProvider(
FULL_COMPLETIONS_SUPPORT,
new KiteCompletionProvider(Kite, pythonCompletionsTriggers), ...pythonCompletionsTriggers)
);
this.disposables.push( this.disposables.push(
vscode.languages.registerSignatureHelpProvider( vscode.languages.registerSignatureHelpProvider(
SIGNATURES_SUPPORT, SIGNATURES_SUPPORT,