Skip to content

Commit a3aaf16

Browse files
committed
partial solution for #74 (single line comments)
1 parent 2284ba9 commit a3aaf16

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/client/providers/completionProvider.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,18 @@ export class PythonCompletionItemProvider implements vscode.CompletionItemProvid
3636
return [];
3737
}
3838
public provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable<vscode.CompletionItem[]> {
39+
if (position.character <= 0) {
40+
return Promise.resolve([]);
41+
}
3942
const filename = document.fileName;
40-
if (document.lineAt(position.line).text.match(/^\s*\/\//)) {
43+
const lineText = document.lineAt(position.line).text;
44+
if (lineText.match(/^\s*\/\//)) {
4145
return Promise.resolve([]);
4246
}
43-
if (position.character <= 0) {
47+
// If starts with a comment, then return
48+
if (lineText.trim().startsWith('#')) {
4449
return Promise.resolve([]);
4550
}
46-
4751
const type = proxy.CommandType.Completions;
4852
const columnIndex = position.character;
4953

0 commit comments

Comments
 (0)