volar-service-typescript
Advanced tools
Comparing version 0.0.42 to 0.0.43-patch.1
@@ -129,3 +129,2 @@ "use strict"; | ||
} | ||
throw new Error(`getTextDocument: uri not found: ${uri}`); | ||
}, | ||
@@ -132,0 +131,0 @@ }; |
@@ -7,3 +7,3 @@ import type { ServiceContext } from '@volar/language-service'; | ||
languageService: ts.LanguageService; | ||
getTextDocument: (uri: string) => TextDocument; | ||
getTextDocument: (uri: string) => TextDocument | undefined; | ||
uriToFileName: (uri: string) => string; | ||
@@ -10,0 +10,0 @@ fileNameToUri: (fileName: string) => string; |
@@ -5,4 +5,4 @@ import type * as vscode from '@volar/language-service'; | ||
import type { SharedContext } from '../semanticFeatures/types'; | ||
export declare function convertDiagnostic(diag: ts.Diagnostic, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.Diagnostic | undefined; | ||
export declare function applyCompletionEntryDetails(ts: typeof import('typescript'), item: vscode.CompletionItem, data: ts.CompletionEntryDetails, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): void; | ||
export declare function convertDiagnostic(diag: ts.Diagnostic, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.Diagnostic | undefined; | ||
export declare function applyCompletionEntryDetails(ts: typeof import('typescript'), item: vscode.CompletionItem, data: ts.CompletionEntryDetails, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): void; | ||
export declare function convertCompletionInfo<T>(ts: typeof import('typescript'), completionContext: ts.CompletionInfo, document: TextDocument, position: vscode.Position, createData: (tsEntry: ts.CompletionEntry) => T): vscode.CompletionList; | ||
@@ -14,9 +14,9 @@ export declare function getLineText(document: TextDocument, line: number): string; | ||
export declare function convertSelectionRange(range: ts.SelectionRange, document: TextDocument): vscode.SelectionRange; | ||
export declare function convertFileTextChanges(changes: readonly ts.FileTextChanges[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.WorkspaceEdit; | ||
export declare function convertRenameLocations(newText: string, locations: readonly ts.RenameLocation[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.WorkspaceEdit; | ||
export declare function convertQuickInfo(ts: typeof import('typescript'), info: ts.QuickInfo, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): vscode.Hover; | ||
export declare function convertFileTextChanges(changes: readonly ts.FileTextChanges[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.WorkspaceEdit; | ||
export declare function convertRenameLocations(newText: string, locations: readonly ts.RenameLocation[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.WorkspaceEdit; | ||
export declare function convertQuickInfo(ts: typeof import('typescript'), info: ts.QuickInfo, document: TextDocument, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): vscode.Hover; | ||
export declare function convertNavTree(item: ts.NavigationTree, document: TextDocument): vscode.DocumentSymbol[]; | ||
export declare function convertOutliningSpan(outliningSpan: ts.OutliningSpan, document: TextDocument): vscode.FoldingRange; | ||
export declare function convertOutliningSpanKind(kind: ts.OutliningSpanKind): vscode.FoldingRangeKind | undefined; | ||
export declare function convertTextChange(edit: ts.TextChange, document: TextDocument): vscode.TextEdit; | ||
export declare function convertTextChange(edit: ts.TextChange, document: TextDocument | undefined): vscode.TextEdit; | ||
export declare function convertCallHierarchyIncomingCall(item: ts.CallHierarchyIncomingCall, ctx: SharedContext): vscode.CallHierarchyIncomingCall; | ||
@@ -28,3 +28,3 @@ export declare function convertCallHierarchyOutgoingCall(item: ts.CallHierarchyOutgoingCall, fromDocument: TextDocument, ctx: SharedContext): vscode.CallHierarchyOutgoingCall; | ||
export declare function convertDocumentSpantoLocationLink(documentSpan: ts.DocumentSpan, ctx: SharedContext): vscode.LocationLink; | ||
export declare function convertTextSpan(textSpan: ts.TextSpan, document: TextDocument): vscode.Range; | ||
export declare function convertTextSpan(textSpan: ts.TextSpan, document: TextDocument | undefined): vscode.Range; | ||
//# sourceMappingURL=lspConverters.d.ts.map |
@@ -784,2 +784,8 @@ "use strict"; | ||
function convertTextSpan(textSpan, document) { | ||
if (!document) { | ||
return { | ||
start: { line: 0, character: 0 }, | ||
end: { line: 0, character: 0 }, | ||
}; | ||
} | ||
return { | ||
@@ -786,0 +792,0 @@ start: document.positionAt(textSpan.start), |
import type * as ts from 'typescript'; | ||
import type { TextDocument } from 'vscode-languageserver-textdocument'; | ||
export declare function plainWithLinks(parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string; | ||
export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string; | ||
export declare function markdownDocumentation(documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string; | ||
export declare function addMarkdownDocumentation(out: string, documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument): string; | ||
export declare function plainWithLinks(parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string; | ||
export declare function tagsMarkdownPreview(tags: readonly ts.JSDocTagInfo[], fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string; | ||
export declare function markdownDocumentation(documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string; | ||
export declare function addMarkdownDocumentation(out: string, documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, fileNameToUri: (fileName: string) => string, getTextDocument: (uri: string) => TextDocument | undefined): string; | ||
//# sourceMappingURL=previewer.d.ts.map |
@@ -109,15 +109,30 @@ "use strict"; | ||
const fileDoc = getTextDocument(fileNameToUri(_target.fileName)); | ||
const start = fileDoc.positionAt(_target.textSpan.start); | ||
const end = fileDoc.positionAt(_target.textSpan.start + _target.textSpan.length); | ||
target = { | ||
file: _target.fileName, | ||
start: { | ||
line: start.line + 1, | ||
offset: start.character + 1, | ||
}, | ||
end: { | ||
line: end.line + 1, | ||
offset: end.character + 1, | ||
}, | ||
}; | ||
if (fileDoc) { | ||
const start = fileDoc.positionAt(_target.textSpan.start); | ||
const end = fileDoc.positionAt(_target.textSpan.start + _target.textSpan.length); | ||
target = { | ||
file: _target.fileName, | ||
start: { | ||
line: start.line + 1, | ||
offset: start.character + 1, | ||
}, | ||
end: { | ||
line: end.line + 1, | ||
offset: end.character + 1, | ||
}, | ||
}; | ||
} | ||
else { | ||
target = { | ||
file: _target.fileName, | ||
start: { | ||
line: 1, | ||
offset: 1, | ||
}, | ||
end: { | ||
line: 1, | ||
offset: 1, | ||
}, | ||
}; | ||
} | ||
} | ||
@@ -124,0 +139,0 @@ if (target) { |
{ | ||
"name": "volar-service-typescript", | ||
"version": "0.0.42", | ||
"version": "0.0.43-patch.1", | ||
"description": "Integrate TypeScript into Volar", | ||
@@ -44,4 +44,3 @@ "homepage": "https://github.com/volarjs/services/tree/master/packages/typescript", | ||
} | ||
}, | ||
"gitHead": "9649e1cc18d7720391567699af9e73f80f076565" | ||
} | ||
} |
157248
3160