mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
💄
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Position, CompletionItemProvider, CompletionItemKind, TextDocument, CancellationToken, CompletionItem, ProviderResult, Range } from 'vscode';
|
||||
import { Position, CompletionItemProvider, CompletionItemKind, TextDocument, CancellationToken, CompletionItem, Range } from 'vscode';
|
||||
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
|
||||
@@ -39,7 +39,11 @@ export default class DirectiveCommentCompletionProvider implements CompletionIte
|
||||
private client: ITypeScriptServiceClient,
|
||||
) { }
|
||||
|
||||
public provideCompletionItems(document: TextDocument, position: Position, _token: CancellationToken): ProviderResult<CompletionItem[]> {
|
||||
public provideCompletionItems(
|
||||
document: TextDocument,
|
||||
position: Position,
|
||||
_token: CancellationToken
|
||||
): CompletionItem[] {
|
||||
if (!this.client.apiVersion.has230Features()) {
|
||||
return [];
|
||||
}
|
||||
@@ -63,7 +67,10 @@ export default class DirectiveCommentCompletionProvider implements CompletionIte
|
||||
return [];
|
||||
}
|
||||
|
||||
public resolveCompletionItem(item: CompletionItem, _token: CancellationToken) {
|
||||
public resolveCompletionItem(
|
||||
item: CompletionItem,
|
||||
_token: CancellationToken
|
||||
) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,12 @@ import { DocumentHighlightProvider, DocumentHighlight, DocumentHighlightKind, Te
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { tsTextSpanToVsRange, vsPositionToTsFileLocation } from '../utils/convert';
|
||||
|
||||
const stringDelimiters = ['"', '\'', '`'];
|
||||
|
||||
export default class TypeScriptDocumentHighlightProvider implements DocumentHighlightProvider {
|
||||
public constructor(
|
||||
private client: ITypeScriptServiceClient) { }
|
||||
private client: ITypeScriptServiceClient
|
||||
) { }
|
||||
|
||||
public async provideDocumentHighlights(
|
||||
resource: TextDocument,
|
||||
@@ -34,7 +36,6 @@ export default class TypeScriptDocumentHighlightProvider implements DocumentHigh
|
||||
if (this.client.apiVersion.has213Features() && firstOccurrence.start.offset > 1) {
|
||||
// Check to see if contents around first occurrence are string delimiters
|
||||
const contents = resource.getText(new Range(firstOccurrence.start.line - 1, firstOccurrence.start.offset - 1 - 1, firstOccurrence.end.line - 1, firstOccurrence.end.offset - 1 + 1));
|
||||
const stringDelimiters = ['"', '\'', '`'];
|
||||
if (contents && contents.length > 2 && stringDelimiters.indexOf(contents[0]) >= 0 && contents[0] === contents[contents.length - 1]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -13,9 +13,14 @@ import { tsTextSpanToVsRange, vsPositionToTsFileLocation } from '../utils/conver
|
||||
export default class TypeScriptHoverProvider implements HoverProvider {
|
||||
|
||||
public constructor(
|
||||
private client: ITypeScriptServiceClient) { }
|
||||
private client: ITypeScriptServiceClient
|
||||
) { }
|
||||
|
||||
public async provideHover(document: TextDocument, position: Position, token: CancellationToken): Promise<Hover | undefined> {
|
||||
public async provideHover(
|
||||
document: TextDocument,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<Hover | undefined> {
|
||||
const filepath = this.client.normalizePath(document.uri);
|
||||
if (!filepath) {
|
||||
return undefined;
|
||||
@@ -35,7 +40,9 @@ export default class TypeScriptHoverProvider implements HoverProvider {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private static getContents(data: Proto.QuickInfoResponseBody) {
|
||||
private static getContents(
|
||||
data: Proto.QuickInfoResponseBody
|
||||
) {
|
||||
const parts = [];
|
||||
|
||||
if (data.displayString) {
|
||||
|
||||
@@ -182,7 +182,7 @@ class TryCompleteJsDocCommand implements Command {
|
||||
template = template.replace(/\* @param([ ]\{\S+\})?\s+(\S+)\s*$/gm, (_param, type, post) => {
|
||||
let out = '* @param ';
|
||||
if (type === ' {any}' || type === ' {*}') {
|
||||
out += `{*\$\{${snippetIndex++}\}} `;
|
||||
out += `{\$\{${snippetIndex++}:*\}} `;
|
||||
} else if (type) {
|
||||
out += type + ' ';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user