All Projects → jgmdev → lite-xl-lsp

jgmdev / lite-xl-lsp

Licence: MIT license
LSP Plugin for Lite XL editor

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to lite-xl-lsp

LspCpp
A Language Server Protocol implementation in C++
Stars: ✭ 40 (-64.29%)
Mutual labels:  language-server-protocol, lsp-client
lxtk
Language Client/Server Toolkit
Stars: ✭ 22 (-80.36%)
Mutual labels:  language-server-protocol, lsp-client
Intelephense
Intellisense for PHP
Stars: ✭ 212 (+89.29%)
Mutual labels:  language-server-protocol
lsp spinner.nvim
neovim plugin to retrieve the name of the running LSP client(s) and display a spinner when there are wip job
Stars: ✭ 23 (-79.46%)
Mutual labels:  lsp-client
Vim Lsp Cxx Highlight
Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
Stars: ✭ 231 (+106.25%)
Mutual labels:  language-server-protocol
Lua Lsp
A Lua language server
Stars: ✭ 219 (+95.54%)
Mutual labels:  language-server-protocol
ide-css
Atom-IDE for CSS, LESS and SCSS language
Stars: ✭ 18 (-83.93%)
Mutual labels:  language-server-protocol
Cquery
C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more
Stars: ✭ 2,338 (+1987.5%)
Mutual labels:  language-server-protocol
LanguageServer.NET
A .NET Standard server-side implementation of Language Server Protocol 2.0/3.x infrastructure library.
Stars: ✭ 78 (-30.36%)
Mutual labels:  language-server-protocol
Csharp Language Server Protocol
Language Server Protocol in C#
Stars: ✭ 230 (+105.36%)
Mutual labels:  language-server-protocol
Theia
Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
Stars: ✭ 15,920 (+14114.29%)
Mutual labels:  language-server-protocol
Haskell Ide Engine
The engine for haskell ide-integration. Not an IDE
Stars: ✭ 2,433 (+2072.32%)
Mutual labels:  language-server-protocol
curry-language-server
IDE support for the functional logic language Curry
Stars: ✭ 18 (-83.93%)
Mutual labels:  language-server-protocol
Lsp
Haskell library for the Microsoft Language Server Protocol
Stars: ✭ 212 (+89.29%)
Mutual labels:  language-server-protocol
agda-language-server
Language Server for Agda
Stars: ✭ 81 (-27.68%)
Mutual labels:  language-server-protocol
Sql Language Server
SQL Language Server
Stars: ✭ 210 (+87.5%)
Mutual labels:  language-server-protocol
Ide Java
Java language support for Atom-IDE
Stars: ✭ 226 (+101.79%)
Mutual labels:  language-server-protocol
Company Lsp
Company completion backend for lsp-mode
Stars: ✭ 238 (+112.5%)
Mutual labels:  language-server-protocol
groovy-language-server
A language server for Groovy
Stars: ✭ 132 (+17.86%)
Mutual labels:  language-server-protocol
lsp-types
Types for communicating with a language server
Stars: ✭ 206 (+83.93%)
Mutual labels:  language-server-protocol

LSP Plugin for Lite XL editor

Plugin that provides intellisense for Lite XL by leveraging the LSP protocol While still a work in progress it already implements all the most important features to make your life easier while coding with Lite XL. Using it requires Lite XL v2.1+ (for Lite XL v2.0.1 to Lite XL v2.0.5 check out the 0.1 branch). Also lint+ is optionally used to render diagnostic messages while you type so make sure to grab that too.

To use, clone this project into the lsp directory in your plugins folder. Finally you will need the Widgets lib so make sure to also drop it into your lite-xl configs directory. For example:

cd ~/.config/lite-xl/
git clone https://github.com/lite-xl/lite-xl-lsp plugins/lsp
git clone https://github.com/lite-xl/lite-xl-widgets widget
git clone https://github.com/liquidev/lintplus plugins/lintplus

The lite-xl configs directory should have:

  • ~/.config/lite-xl/widget/
  • ~/.config/lite-xl/plugins/lsp/
  • ~/.config/lite-xl/plugins/lintplus/

Features

Stuff that is currently implemented:

  • Code auto completion (ctrl+space)
  • Function signatures tooltip (ctrl+shift+space)
  • Current cursor symbol details tooltip on mouse hover or shortcut (alt+a)
  • Goto definition (alt+d)
  • Goto implementation (alt+shift+d)
  • View/jump to current document symbols (alt+s)
  • Find workspace symbols (alt+shift+s)
  • View/jump to symbol references (alt+f)
  • View/jump to document diagnostic messages (alt+e)
  • Document format (alt+shift+f)
  • Optional diagnostics rendering while typing with lint+ (alt+shift+e to toggle)
  • List all documents with diagnostics (ctrl+alt+e)

Setting a LSP Server

The easiest method of setting up a lsp server is by using the config.lua file shipped with the lsp plugin which already contains a list of predefined servers (notice: not all of them have been tested to work). Require this file on your users init.lua, call setup() on the desired lsp servers or overwrite the configuration options of the defined lsp servers if needed as shown below:

Examples:

local lspconfig = require "plugins.lsp.config"

-- Activate clangd without overwriting any settings for c/c++
-- autocompletion (requires a compile_commands.json file on
-- your project directory usually generated by build tools
-- like cmake or meson)
-- See: https://clangd.llvm.org/installation.html#project-setup
lspconfig.clangd.setup()

-- Activate gopls
lspconfig.gopls.setup()

-- Activate the lua-language-server, set the server command and
-- modify the default settings in order to disable diagnostics.
lspconfig.sumneko_lua.setup {
  command = {
    "/path/to/lua-language-server/bin/Linux/lua-language-server",
    "-E",
    "/path/to/lua-language-server/main.lua"
  },
  settings = {
    Lua = {
      diagnostics = {
        enable = false
      }
    }
  }
}

-- Activate intelephense and pass additional initializationOptions
-- like the license key and storage path.
lspconfig.intelephense.setup {
  init_options = {
    licenceKey = "MYLICENSEKEY",
    storagePath = "/home/myuser/.cache/intelephense"
  }
}

If your preferred LSP server is not listed on the config.lua file feel free to submit a pull request with the addition!

Manually Configuring a LSP Server

Besides the config.lua method, you can fully define an lsp server in your user init.lua file. You would need to require the lsp plugin and use the add_server function as shown on the following example:

local lsp = require "plugins.lsp"

lsp.add_server {
  -- Name of server
  name = "intelephense",
  -- Main language
  language = "PHP",
  -- File types that are supported by this server
  file_patterns = { "%.php$" },
  -- LSP command and optional arguments
  command = { "intelephense", "--stdio" },
  -- Optional table of settings to pass into the lsp
  -- Note that also having a settings.json or settings.lua in
  -- your workspace directory with a table of settings is supported.
  settings = {
    intelephense = {
      files = {
        exclude = {
          "**/.git/**"
        }
      }
    }
  },
  -- Optional table of initializationOptions for the LSP
  init_options = {
    storagePath = "/home/myuser/.cache/intelephense"
  },
  -- Set by default to 16 should only be modified if having issues with a server
  requests_per_second = 16,
  -- By default each request is written to the server stdin in chunks of
  -- 10KB, if this gives issues set to false to write everything at once.
  requests_in_chunks = true,
  -- Some servers like bash language server support incremental changes
  -- which are more performant but don't advertise it, set to true to force
  -- incremental changes even if server doesn't advertise them.
  incremental_changes = false,
  -- True to debug the lsp client when developing it
  verbose = false
}

LSP Plugin Settings

Configuration options that can be used to control the plugin behaviour:

---Show a symbol hover information when mouse cursor is on top.
---@type boolean
config.plugins.lsp.mouse_hover = true,

---The amount of time in milliseconds before showing the tooltip.
---@type integer
config.plugins.lsp.mouse_hover_delay = 300,

---Show diagnostic messages
---@type boolean
config.plugins.lsp.show_diagnostics = true

---Stop servers that aren't needed by any of the open files
---@type boolean
config.plugins.lsp.stop_unneeded_servers = true

---Set to a file path to log all json
---@type string
config.plugins.lsp.log_file = ""

---Setting to true prettyfies json for more readability on the log
---but this setting will impact performance so only enable it when
---in need of easy to read json output when developing the plugin.
---@type boolean
config.plugins.lsp.prettify_json = false

---Send a server stderr output to lite log
---@type boolean
config.plugins.lsp.log_server_stderr = false

---Force verbosity off even if a server is configured with verbosity on
---@type boolean
config.plugins.lsp.force_verbosity_off = false

---Yield when reading from LSP which may give you better UI responsiveness
---when receiving large responses, but will affect LSP performance.
---@type boolean
config.plugins.lsp.more_yielding = false

TODO

  • Properly handle multiple opened project directories
  • Handle window/showMessage, window/showMessageRequest, $/progress, telemetry/event
  • Be able to search workspace symbols 'workspace/symbol'
  • Completion preselectSupport (needs autocomplete plugin change)
  • Add symbol renaming support 'textDocument/rename'
  • Add Snippets support (this will need a whole standalone plugin).
  • Fix issues when parsing stdout from some lsp servers (really fixed?).
  • More improvements to autocomplete.lua plugin
    • Detect view edges and render to the most visible side
    • Description box, detect view width and expand accordingly
    • Support for pre-selected item
    • Be able to use a custom sorting field.
  • Add hover support for function arguments
    • Add custom tooltip that accents active parameter and signature
  • Figure out how to get an autocompletion item full documentation with 'completionItem/resolve' or any other in order to better populate the new autocomplete item description
  • (we kill it) Detect if lsp server hangs and restart it (eg: clangd)
  • Exit LSP server if no open document needs it.
  • Add hover support for symbols
  • Generate list of current document symbols for easy document navigation
  • Goto definition
    • Display select box when more than one result
  • Show diagnostics on active document similar to the linter plugin.
  • Send incremental changes on textDocument/didChange notification since sending the whole document content on big files is slow and bad.

Screenshots

Some images to easily visualize the progress :)

Completion

Completion

Completion

Completion

Completion

Symbol hover

Hover

Hover

Function signatures

Signature

Document symbols

Doc Symbols Doc Symbols

Goto definition

Goto Definition

Diagnostics rendering using Lint+

Diagnostics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].