vscode-typescript-languageservice
Advanced tools
Comparing version 0.26.15 to 0.26.16
@@ -27,3 +27,3 @@ import * as vscode from 'vscode-languageserver'; | ||
getSignatureHelp: (uri: string, position: vscode.Position, context?: vscode.SignatureHelpContext | undefined) => vscode.SignatureHelp | undefined; | ||
getSelectionRange: (uri: string, position: vscode.Position) => vscode.SelectionRange | undefined; | ||
getSelectionRanges: (uri: string, positions: vscode.Position[]) => vscode.SelectionRange[]; | ||
doValidation: (uri: string, options: { | ||
@@ -30,0 +30,0 @@ semantic?: boolean | undefined; |
@@ -50,3 +50,3 @@ "use strict"; | ||
getSignatureHelp: signatureHelp.register(languageService, getValidTextDocument, ts), | ||
getSelectionRange: selectionRanges.register(languageService, getValidTextDocument), | ||
getSelectionRanges: selectionRanges.register(languageService, getValidTextDocument), | ||
doValidation: diagnostics.register(languageService, getValidTextDocument, ts), | ||
@@ -53,0 +53,0 @@ getFoldingRanges: foldingRanges.register(languageService, getValidTextDocument, ts), |
import type * as ts from 'typescript'; | ||
import * as vscode from 'vscode-languageserver'; | ||
import type { TextDocument } from 'vscode-languageserver-textdocument'; | ||
export declare function register(languageService: ts.LanguageService, getTextDocument: (uri: string) => TextDocument | undefined): (uri: string, position: vscode.Position) => vscode.SelectionRange | undefined; | ||
export declare function register(languageService: ts.LanguageService, getTextDocument: (uri: string) => TextDocument | undefined): (uri: string, positions: vscode.Position[]) => vscode.SelectionRange[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.register = void 0; | ||
const shared = require("@volar/shared"); | ||
const vscode = require("vscode-languageserver"); | ||
const shared = require("@volar/shared"); | ||
function register(languageService, getTextDocument) { | ||
return (uri, position) => { | ||
return (uri, positions) => { | ||
const document = getTextDocument(uri); | ||
if (!document) | ||
return; | ||
const fileName = shared.uriToFsPath(document.uri); | ||
const offset = document.offsetAt(position); | ||
const range = languageService.getSmartSelectionRange(fileName, offset); | ||
return { | ||
range: vscode.Range.create(document.positionAt(range.textSpan.start), document.positionAt(range.textSpan.start + range.textSpan.length)) | ||
}; | ||
return []; | ||
const result = []; | ||
for (const position of positions) { | ||
const fileName = shared.uriToFsPath(document.uri); | ||
const offset = document.offsetAt(position); | ||
const range = languageService.getSmartSelectionRange(fileName, offset); | ||
result.push(transformSelectionRange(range, document)); | ||
} | ||
return result; | ||
}; | ||
} | ||
exports.register = register; | ||
function transformSelectionRange(range, document) { | ||
return { | ||
range: vscode.Range.create(document.positionAt(range.textSpan.start), document.positionAt(range.textSpan.start + range.textSpan.length)), | ||
parent: range.parent ? transformSelectionRange(range.parent, document) : undefined, | ||
}; | ||
} | ||
//# sourceMappingURL=selectionRanges.js.map |
{ | ||
"name": "vscode-typescript-languageservice", | ||
"version": "0.26.15", | ||
"version": "0.26.16", | ||
"main": "out/index.js", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/shared": "^0.26.15", | ||
"@volar/shared": "^0.26.16", | ||
"upath": "^2.0.1", | ||
@@ -25,3 +25,3 @@ "vscode-languageserver": "^8.0.0-next.1", | ||
}, | ||
"gitHead": "46717ddbcb7b600e15ba8524537764d326430ce8" | ||
"gitHead": "c3fca46675aeeb1e591df13f2cfc05c1b37ec1e5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112791
2207
Updated@volar/shared@^0.26.16