-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
detect imported identifiers, improve sourcemaps, and filter completio…
…ns by context (#299) * detect imported identifiers * improve sourcemaps and completions * update snapshots
- Loading branch information
Showing
37 changed files
with
1,456 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
extensions/vscode-vue-language-features/src/services/TriggerCompletionService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { injectable } from 'inversify' | ||
import vscode, { Disposable } from 'vscode' | ||
import { Installable } from '../utils/installable' | ||
|
||
@injectable() | ||
export class TriggerCompletionService | ||
extends Installable | ||
implements vscode.CompletionItemProvider | ||
{ | ||
public install(): Disposable { | ||
super.install() | ||
|
||
return vscode.languages.registerCompletionItemProvider( | ||
{ language: 'vue' }, | ||
this, | ||
...[':', '^'], | ||
) | ||
} | ||
|
||
async provideCompletionItems( | ||
document: vscode.TextDocument, | ||
position: vscode.Position, | ||
_token: vscode.CancellationToken, | ||
context: vscode.CompletionContext, | ||
): Promise<vscode.CompletionItem[]> { | ||
if (context.triggerCharacter == null) return [] | ||
// TODO: check if at directive node | ||
return await vscode.commands.executeCommand( | ||
'vscode.executeCompletionItemProvider', | ||
document.uri, | ||
position, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.