aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-12-13 07:54:47 +0100
committerGitHub <noreply@github.com>2021-12-13 07:54:47 +0100
commitd7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2 (patch)
tree0c697a373655d0e5fd2907ff5787942001c86cf2
parent.github: update new server request template (diff)
downloadmason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.gz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.bz2
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.lz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.xz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.zst
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.zip
feat: allow server installation by just typing `:LspInstall` (#331)
This will prompt the user which server associated with the currently opened buffer's &filetype to install.
-rw-r--r--README.md2
-rw-r--r--doc/nvim-lsp-installer.txt15
-rw-r--r--lua/nvim-lsp-installer.lua23
-rw-r--r--plugin/nvim-lsp-installer.vim15
4 files changed, 48 insertions, 7 deletions
diff --git a/README.md b/README.md
index 9168e699..e16cd97d 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ Plug 'williamboman/nvim-lsp-installer'
### Commands
- `:LspInstallInfo` - opens a graphical overview of your language servers
-- `:LspInstall [--sync] <server> ...` - installs/reinstalls language servers. Runs in a blocking fashion if the `--sync` argument is passed (only recommended for scripting purposes).
+- `:LspInstall [--sync] [server] ...` - installs/reinstalls language servers. Runs in a blocking fashion if the `--sync` argument is passed (only recommended for scripting purposes).
- `:LspUninstall [--sync] <server> ...` - uninstalls language servers. Runs in a blocking fashion if the `--sync` argument is passed (only recommended for scripting purposes).
- `:LspUninstallAll [--no-confirm]` - uninstalls all language servers
- `:LspInstallLog` - opens the log file in a new tab window
diff --git a/doc/nvim-lsp-installer.txt b/doc/nvim-lsp-installer.txt
index 5a9794a7..14703df6 100644
--- a/doc/nvim-lsp-installer.txt
+++ b/doc/nvim-lsp-installer.txt
@@ -79,6 +79,12 @@ of the server name, like so: >
:LspInstall tsserver@0.6.3 graphql@latest rust_analyzer@nightly
<
+To install a server associated with the filetype of the currently opened
+buffer, simply just run: >
+
+ :LspInstall
+<
+
Please refer to each server's own release page to find which versions are
available.
@@ -130,15 +136,20 @@ COMMANDS *nvim-lsp-installer-commands*
Opens the UI for nvim-lsp-installer.
*:LspInstall*
-:LspInstall [--sync] {server_name} ...
+:LspInstall [--sync] [server_name] ...
Installs language servers. If the `--sync` argument is passed, the command will
be blocking until all installations complete. This is useful for headless
installations, for example: >
$ nvim --headless -c "LspInstall --sync rust_analyzer clangd clojure_lsp" -c q
-
<
+
+If no server names are provided (`:LspInstall`), you will be prompted to
+select which server associated with the currently opened buffer's filetype you
+want to install. If none are associated, an error message will be printed
+instead.
+
*:LspUninstall*
:LspUninstall [--sync] {server_name} ...
diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua
index 3a7e8b2f..62b20a1e 100644
--- a/lua/nvim-lsp-installer.lua
+++ b/lua/nvim-lsp-installer.lua
@@ -8,6 +8,7 @@ local settings = require "nvim-lsp-installer.settings"
local log = require "nvim-lsp-installer.log"
local platform = require "nvim-lsp-installer.platform"
local language_autocomplete_map = require "nvim-lsp-installer._generated.language_autocomplete_map"
+local filetype_server_map = require "nvim-lsp-installer._generated.filetype_map"
local M = {}