-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prototype definition and span API #40045
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1896,6 +1896,13 @@ declare module 'vscode' { | |
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>; | ||
} | ||
|
||
export class DefinitionAndSpan { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to make this use a single definition instead: class DefinitionAndSpan {
span: Location;
definition: Location;
} My original thinking was to bundle the concept of a definition into a class, i.e. this text range corresponds to these X definitions. However I'm not sure this makes sense since we later flatten out the definition list in the UI anyways There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I'm thinking of renaming this type. Something like |
||
span: Location; | ||
definitions: Location[]; | ||
|
||
constructor(span: Location, definitions: Location[]); | ||
} | ||
|
||
/** | ||
* The definition of a symbol represented as one or many [locations](#Location). | ||
* For most programming languages there is only one location at which a symbol is | ||
|
@@ -1919,7 +1926,7 @@ declare module 'vscode' { | |
* @return A definition or a thenable that resolves to such. The lack of a result can be | ||
* signaled by returning `undefined` or `null`. | ||
*/ | ||
provideDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition>; | ||
provideDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionAndSpan>; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change currently breaks the
vscode.executeDefinitionProvider
command. It previously returnedLocation[]
but will now return aDefinitionAndSpan[]