Fork of daniellemaywood.uk/gleam — Wasm codegen work
1

Configure Feed

Select the types of activity you want to include in your feed.

gleam / compiler-core / wit / zed_extension / 0.7.0 / extension.wit
8.0 kB 167 lines
1package zed:extension; 2 3world extension { 4 import context-server; 5 import dap; 6 import github; 7 import http-client; 8 import platform; 9 import process; 10 import nodejs; 11 12 use common.{env-vars, range}; 13 use context-server.{context-server-configuration}; 14 use dap.{attach-request, build-task-template, debug-config, debug-adapter-binary, debug-task-definition, debug-request, debug-scenario, launch-request, resolved-task, start-debugging-request-arguments-request}; 15 use lsp.{completion, symbol}; 16 use process.{command}; 17 use slash-command.{slash-command, slash-command-argument-completion, slash-command-output}; 18 19 /// Initializes the extension. 20 export init-extension: func(); 21 22 /// The type of a downloaded file. 23 enum downloaded-file-type { 24 /// A gzipped file (`.gz`). 25 gzip, 26 /// A gzipped tar archive (`.tar.gz`). 27 gzip-tar, 28 /// A ZIP file (`.zip`). 29 zip, 30 /// An uncompressed file. 31 uncompressed, 32 } 33 34 /// The installation status for a language server. 35 variant language-server-installation-status { 36 /// The language server has no installation status. 37 none, 38 /// The language server is being downloaded. 39 downloading, 40 /// The language server is checking for updates. 41 checking-for-update, 42 /// The language server installation failed for specified reason. 43 failed(string), 44 } 45 46 record settings-location { 47 worktree-id: u64, 48 path: string, 49 } 50 51 import get-settings: func(path: option<settings-location>, category: string, key: option<string>) -> result<string, string>; 52 53 /// Downloads a file from the given URL and saves it to the given path within the extension's 54 /// working directory. 55 /// 56 /// The file will be extracted according to the given file type. 57 import download-file: func(url: string, file-path: string, file-type: downloaded-file-type) -> result<_, string>; 58 59 /// Makes the file at the given path executable. 60 import make-file-executable: func(filepath: string) -> result<_, string>; 61 62 /// Updates the installation status for the given language server. 63 import set-language-server-installation-status: func(language-server-name: string, status: language-server-installation-status); 64 65 /// A Zed worktree. 66 resource worktree { 67 /// Returns the ID of the worktree. 68 id: func() -> u64; 69 /// Returns the root path of the worktree. 70 root-path: func() -> string; 71 /// Returns the textual contents of the specified file in the worktree. 72 read-text-file: func(path: string) -> result<string, string>; 73 /// Returns the path to the given binary name, if one is present on the `$PATH`. 74 which: func(binary-name: string) -> option<string>; 75 /// Returns the current shell environment. 76 shell-env: func() -> env-vars; 77 } 78 79 /// A Zed project. 80 resource project { 81 /// Returns the IDs of all of the worktrees in this project. 82 worktree-ids: func() -> list<u64>; 83 } 84 85 /// A key-value store. 86 resource key-value-store { 87 /// Inserts an entry under the specified key. 88 insert: func(key: string, value: string) -> result<_, string>; 89 } 90 91 /// Returns the command used to start up the language server. 92 export language-server-command: func(language-server-id: string, worktree: borrow<worktree>) -> result<command, string>; 93 94 /// Returns the initialization options to pass to the language server on startup. 95 /// 96 /// The initialization options are represented as a JSON string. 97 export language-server-initialization-options: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>; 98 99 /// Returns the workspace configuration options to pass to the language server. 100 export language-server-workspace-configuration: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>; 101 102 /// Returns the initialization options to pass to the other language server. 103 export language-server-additional-initialization-options: func(language-server-id: string, target-language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>; 104 105 /// Returns the workspace configuration options to pass to the other language server. 106 export language-server-additional-workspace-configuration: func(language-server-id: string, target-language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>; 107 108 /// A label containing some code. 109 record code-label { 110 /// The source code to parse with Tree-sitter. 111 code: string, 112 /// The spans to display in the label. 113 spans: list<code-label-span>, 114 /// The range of the displayed label to include when filtering. 115 filter-range: range, 116 } 117 118 /// A span within a code label. 119 variant code-label-span { 120 /// A range into the parsed code. 121 code-range(range), 122 /// A span containing a code literal. 123 literal(code-label-span-literal), 124 } 125 126 /// A span containing a code literal. 127 record code-label-span-literal { 128 /// The literal text. 129 text: string, 130 /// The name of the highlight to use for this literal. 131 highlight-name: option<string>, 132 } 133 134 export labels-for-completions: func(language-server-id: string, completions: list<completion>) -> result<list<option<code-label>>, string>; 135 export labels-for-symbols: func(language-server-id: string, symbols: list<symbol>) -> result<list<option<code-label>>, string>; 136 137 138 /// Returns the completions that should be shown when completing the provided slash command with the given query. 139 export complete-slash-command-argument: func(command: slash-command, args: list<string>) -> result<list<slash-command-argument-completion>, string>; 140 141 /// Returns the output from running the provided slash command. 142 export run-slash-command: func(command: slash-command, args: list<string>, worktree: option<borrow<worktree>>) -> result<slash-command-output, string>; 143 144 /// Returns the command used to start up a context server. 145 export context-server-command: func(context-server-id: string, project: borrow<project>) -> result<command, string>; 146 147 /// Returns the configuration for a context server. 148 export context-server-configuration: func(context-server-id: string, project: borrow<project>) -> result<option<context-server-configuration>, string>; 149 150 /// Returns a list of packages as suggestions to be included in the `/docs` 151 /// search results. 152 /// 153 /// This can be used to provide completions for known packages (e.g., from the 154 /// local project or a registry) before a package has been indexed. 155 export suggest-docs-packages: func(provider-name: string) -> result<list<string>, string>; 156 157 /// Indexes the docs for the specified package. 158 export index-docs: func(provider-name: string, package-name: string, database: borrow<key-value-store>) -> result<_, string>; 159 160 /// Returns a configured debug adapter binary for a given debug task. 161 export get-dap-binary: func(adapter-name: string, config: debug-task-definition, user-installed-path: option<string>, worktree: borrow<worktree>) -> result<debug-adapter-binary, string>; 162 /// Returns the kind of a debug scenario (launch or attach). 163 export dap-request-kind: func(adapter-name: string, config: string) -> result<start-debugging-request-arguments-request, string>; 164 export dap-config-to-scenario: func(config: debug-config) -> result<debug-scenario, string>; 165 export dap-locator-create-scenario: func(locator-name: string, build-config-template: build-task-template, resolved-label: string, debug-adapter-name: string) -> option<debug-scenario>; 166 export run-dap-locator: func(locator-name: string, config: resolved-task) -> result<debug-request, string>; 167}