mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Changed command designed based on review input
This commit is contained in:
1 parent
c6a8a32b71
commit
b86153da88
9 files changed
+103
-44
No files matched your search
+15
-10
@@ -1411,6 +1411,20 @@ namespace ts {
|
||||
return GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
||||
}
|
||||
|
||||
function getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan {
|
||||
const definitions = getDefinitionAtPosition(fileName, position);
|
||||
|
||||
if (!definitions) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const sourceFile = getValidSourceFile(fileName);
|
||||
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
const textSpan = createTextSpan(node.getStart(), node.getWidth());
|
||||
|
||||
return { definitions, textSpan };
|
||||
}
|
||||
|
||||
function getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
synchronizeHostData();
|
||||
return GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position);
|
||||
@@ -1807,15 +1821,6 @@ namespace ts {
|
||||
return range && createTextSpanFromRange(range);
|
||||
}
|
||||
|
||||
function getSpanForPosition(fileName: string, position: number): TextSpan {
|
||||
synchronizeHostData();
|
||||
|
||||
const sourceFile = getValidSourceFile(fileName);
|
||||
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocCcomment*/ false);
|
||||
|
||||
return createTextSpan(node.getStart(), node.getWidth());
|
||||
}
|
||||
|
||||
function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||
// Note: while getting todo comments seems like a syntactic operation, we actually
|
||||
// treat it as a semantic operation here. This is because we expect our host to call
|
||||
@@ -2018,6 +2023,7 @@ namespace ts {
|
||||
getSignatureHelpItems,
|
||||
getQuickInfoAtPosition,
|
||||
getDefinitionAtPosition,
|
||||
getDefinitionAndBoundSpan,
|
||||
getImplementationAtPosition,
|
||||
getTypeDefinitionAtPosition,
|
||||
getReferencesAtPosition,
|
||||
@@ -2041,7 +2047,6 @@ namespace ts {
|
||||
getDocCommentTemplateAtPosition,
|
||||
isValidBraceCompletionAtPosition,
|
||||
getSpanOfEnclosingComment,
|
||||
getSpanForPosition,
|
||||
getCodeFixesAtPosition,
|
||||
getEmitOutput,
|
||||
getNonBoundSourceFile,
|
||||
|
||||
@@ -245,6 +245,7 @@ namespace ts {
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan;
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[];
|
||||
|
||||
@@ -273,7 +274,6 @@ namespace ts {
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
|
||||
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
|
||||
getSpanForPosition(fileName: string, position: number): TextSpan;
|
||||
|
||||
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[];
|
||||
getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[];
|
||||
@@ -549,6 +549,11 @@ namespace ts {
|
||||
containerName: string;
|
||||
}
|
||||
|
||||
export interface DefinitionInfoAndBoundSpan {
|
||||
definitions: ReadonlyArray<DefinitionInfo>;
|
||||
textSpan: TextSpan;
|
||||
}
|
||||
|
||||
export interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user