Skip to content

Commit

Permalink
Add types for hierarchical document symbols
Browse files Browse the repository at this point in the history
Just exists on a branch of vscode-languageserver-node atm, see microsoft/vscode-languageserver-node#373.
  • Loading branch information
Gama11 committed Jul 17, 2018
1 parent 1629309 commit ab81d33
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
46 changes: 46 additions & 0 deletions src/languageServerProtocol/Types.hx
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,52 @@ typedef SymbolInformation = {
var ?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.
**/
typedef DocumentSymbol = {
/**
The name of this symbol.
**/
var name:String;

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

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

/**
Indicates if this symbol is deprecated.
**/
var ?deprecated:Bool;

/**
The range enclosing this symbol not including leading/trailing whitespace but everything else
like comments. This information is typically used to determine if the the clients cursor is
inside the symbol to reveal in the symbol in the UI.
**/
var range:Range;

/**
The range that should be selected and reveal when this symbol is being picked, e.g the name of a function.
Must be contained by the the `range`.
**/
var selectionRange:Range;

/**
Children of this symbol, e.g. properties of a class.
**/
var ?children:Array<DocumentSymbol>;
}

/**
Parameters for a `DocumentSymbols` request.
**/
Expand Down
7 changes: 6 additions & 1 deletion src/languageServerProtocol/protocol/Protocol.hx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Methods {
/**
The document symbol request is sent from the client to the server to list all symbols found in a given text document.
**/
static inline var DocumentSymbols = new RequestMethod<DocumentSymbolParams,Null<Array<SymbolInformation>>,NoData,TextDocumentRegistrationOptions>("textDocument/documentSymbol");
static inline var DocumentSymbols = new RequestMethod<DocumentSymbolParams,Null<Array<EitherType<SymbolInformation,DocumentSymbol>>>,NoData,TextDocumentRegistrationOptions>("textDocument/documentSymbol");

/**
The workspace symbol request is sent from the client to the server to list project-wide symbols matching the query string.
Expand Down Expand Up @@ -599,6 +599,11 @@ typedef TextDocumentClientCapabilities =
**/
var ?valueSet:Array<SymbolKind>;
};

/**
The client support hierarchical document symbols.
**/
var ?hierarchicalDocumentSymbolSupport:Bool;
};

/**
Expand Down

0 comments on commit ab81d33

Please sign in to comment.