Add label_for_symbol to extension API (#10179)

This PR adds `label_for_symbol` to the extension API.

As a motivating example, we implemented `label_for_symbol` for the
Haskell extension.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Marshall Bowers 2024-04-04 15:38:38 -04:00 committed by GitHub
parent 5d88d9c0d7
commit 4a325614f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 238 additions and 43 deletions

View file

@ -3,7 +3,7 @@ package zed:extension;
world extension {
import lsp;
use lsp.{completion};
use lsp.{completion, symbol};
export init-extension: func();
@ -117,4 +117,5 @@ world extension {
}
export labels-for-completions: func(language-server-id: string, completions: list<completion>) -> result<list<option<code-label>>, string>;
export labels-for-symbols: func(language-server-id: string, symbols: list<symbol>) -> result<list<option<code-label>>, string>;
}

View file

@ -41,4 +41,39 @@ interface lsp {
snippet,
other(s32),
}
record symbol {
kind: symbol-kind,
name: string,
}
variant symbol-kind {
file,
module,
namespace,
%package,
class,
method,
property,
field,
%constructor,
%enum,
%interface,
function,
variable,
constant,
%string,
number,
boolean,
array,
object,
key,
null,
enum-member,
struct,
event,
operator,
type-parameter,
other(s32),
}
}