mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 13:43:07 +00:00
Fix #37919 - don't show php suggestions when closing an html tag
This commit is contained in:
parent
6e90f8995d
commit
ddb27c6312
1 changed files with 10 additions and 2 deletions
|
@ -5,12 +5,12 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Position, Range, TextEdit, workspace } from 'vscode';
|
||||
import { CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Position, Range, TextEdit, workspace, CompletionContext } from 'vscode';
|
||||
import phpGlobals = require('./phpGlobals');
|
||||
|
||||
export default class PHPCompletionItemProvider implements CompletionItemProvider {
|
||||
|
||||
public provideCompletionItems(document: TextDocument, position: Position, _token: CancellationToken): Promise<CompletionItem[]> {
|
||||
public provideCompletionItems(document: TextDocument, position: Position, _token: CancellationToken, context: CompletionContext): Promise<CompletionItem[]> {
|
||||
let result: CompletionItem[] = [];
|
||||
|
||||
let shouldProvideCompletionItems = workspace.getConfiguration('php').get<boolean>('suggest.basic', true);
|
||||
|
@ -24,6 +24,14 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
|
|||
range = new Range(position, position);
|
||||
}
|
||||
|
||||
if (context.triggerCharacter === '>') {
|
||||
const twoBeforeCursor = new Position(position.line, Math.max(0, position.character - 2));
|
||||
const previousTwoChars = document.getText(new Range(twoBeforeCursor, position));
|
||||
if (previousTwoChars !== '->') {
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
}
|
||||
|
||||
var added: any = {};
|
||||
var createNewProposal = function (kind: CompletionItemKind, name: string, entry: phpGlobals.IEntry | null): CompletionItem {
|
||||
var proposal: CompletionItem = new CompletionItem(name);
|
||||
|
|
Loading…
Reference in a new issue