Skip to content

Commit

Permalink
move DocumentSymbol API to vscode.d.ts, #34968
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 18, 2018
1 parent 7753381 commit c1226cf
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 54 deletions.
52 changes: 51 additions & 1 deletion src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,56 @@ declare module 'vscode' {
constructor(name: string, kind: SymbolKind, range: Range, uri?: Uri, containerName?: string);
}

/**
* Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document
* symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to
* its most interesting range, e.g. the range of an identifier.
*/
export class DocumentSymbol {

/**
* The name of this symbol.
*/
name: string;

/**
* More detail for this symbol, e.g the signature of a function.
*/
detail: string;

/**
* The kind of this symbol.
*/
kind: SymbolKind;

/**
* The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g comments and code.
*/
range: Range;

/**
* The range that should be selected and reveal when this symbol is being pciked, e.g the name of a function.

This comment has been minimized.

Copy link
@KamasamaK

KamasamaK Jun 18, 2018

@jrieken There is a misspelling here: "pciked"

This comment has been minimized.

Copy link
@jrieken

jrieken Jun 18, 2018

Author Member

thanks

* Must be contained by the [`fullRange`](#DocumentSymbol.fullRange).
*/
selectionRange: Range;

/**
* Children of this symbol, e.g. properties of a class.
*/
children: DocumentSymbol[];

/**
* Creates a new document symbol.
*
* @param name The name of the symbol.
* @param detail Details for the symbol.
* @param kind The kind of the symbol.
* @param range The full range of the symbol.
* @param selectionRange The range that should be reveal.
*/
constructor(name: string, detail: string, kind: SymbolKind, range: Range, selectionRange: Range);
}

/**
* The document symbol provider interface defines the contract between extensions and
* the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.
Expand All @@ -2480,7 +2530,7 @@ declare module 'vscode' {
* @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined`, `null`, or an empty array.
*/
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[]>;
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}

/**
Expand Down
53 changes: 0 additions & 53 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,59 +377,6 @@ declare module 'vscode' {

//#endregion

//#region Joh: hierarchical document symbols, https://github.com/Microsoft/vscode/issues/34968

export class DocumentSymbol {

/**
* The name of this symbol.
*/
name: string;

/**
* More detail for this symbol, e.g the signature of a function.
*/
detail: string;

/**
* The kind of this symbol.
*/
kind: SymbolKind;

/**
* The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g comments and code.
*/
range: Range;

/**
* The range that should be selected and reveal when this symbol is being pciked, e.g the name of a function.
* Must be contained by the [`fullRange`](#DocumentSymbol.fullRange).
*/
selectionRange: Range;

/**
* Children of this symbol, e.g. properties of a class.
*/
children: DocumentSymbol[];

/**
* Creates a new document symbol.
*
* @param name The name of the symbol.
* @param detail Details for the symbol.
* @param kind The kind of the symbol.
* @param range The full range of the symbol.
* @param selectionRange The range that should be reveal.
*/
constructor(name: string, detail: string, kind: SymbolKind, range: Range, selectionRange: Range);
}

export interface DocumentSymbolProvider {
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}

//#endregion

//#region Joh -> exclusive document filters

export interface DocumentFilter {
Expand Down

0 comments on commit c1226cf

Please sign in to comment.