Bläddra i källkod

Minor fixes to LSP doc

Vlad Protsenko 2 år sedan
förälder
incheckning
037b8c957f
1 ändrade filer med 14 tillägg och 10 borttagningar
  1. 14 10
      docs/en/manuals/editor-scripts.md

+ 14 - 10
docs/en/manuals/editor-scripts.md

@@ -208,7 +208,7 @@ You can publish libraries for other people to use that contain commands, and the
 Also note that although dependencies are shown in Assets view, they do not exist as files (they are entries in a zip archive), so there is currently no easy way to execute a shell script you provide in a dependency. If you absolutely need it, you'll have to extract provided scripts by getting their text using `editor.get()` and then writing them somewhere with `file:write()`, for example in a `build/editor-scripts/your-extension-name` folder.
 
 A simpler way to extract the necessary files is to use native extensions' plugins system.
-To do it, you need to create `ext.mainfest` file in your library folder, and then create `plugins/bin/${platform}` folder in the same folder where the `ext.manifest` file is located. Files in that folder will be automatically extracted to `/build/plugins/${extension-path}/plugins/bin/${platform}` folder, so your editor scripts can reference them.
+To do it, you need to create `ext.manifest` file in your library folder, and then create `plugins/bin/${platform}` folder in the same folder where the `ext.manifest` file is located. Files in that folder will be automatically extracted to `/build/plugins/${extension-path}/plugins/bin/${platform}` folder, so your editor scripts can reference them.
 
 ## Language servers
 
@@ -218,20 +218,24 @@ To define the language server, you need to edit your editor script's `get_langua
 
 ```lua
 function M.get_language_servers()
-    return {
-      {
-        languages = {'lua'},
-        watched_files = {
-          { pattern = '**/.luacheckrc' }
-        },
-        command = {'build/plugins/my-ext/plugins/bin/x86_64-macos/lua-lsp.sh', '--stdio'}
-      }
+  local command = 'build/plugins/my-ext/plugins/bin/' .. editor.platform .. '/lua-lsp'
+  if editor.platform == 'x86_64-win32' then
+    command = command .. '.exe'
+  end
+  return {
+    {
+      languages = {'lua'},
+      watched_files = {
+        { pattern = '**/.luacheckrc' }
+      },
+      command = {command, '--stdio'}
     }
+  }
 end
 ```
 The editor will start the language server using the specified `command`, using the server process's standard input and output for communication.
 
-Language server table may specify:
+Language server definition table may specify:
 - `languages` (required) — a list of languages the server is interested in, as defined [here](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers) (file extensions also work);
 - `command` (required) - an array of command and its arguments
 - `watched_files` - an array of tables with `pattern` keys (a glob) that will trigger the server's [watched files changed](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeWatchedFiles) notification.