Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xna00/unocss-language-server
https://github.com/xna00/unocss-language-server
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/xna00/unocss-language-server
- Owner: xna00
- License: mit
- Created: 2022-11-10T02:36:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-20T04:59:03.000Z (5 months ago)
- Last Synced: 2024-08-02T16:54:19.397Z (3 months ago)
- Language: TypeScript
- Size: 696 KB
- Stars: 53
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UnoCSS Language Server
A language server for unocss
## Features
* Simple completion
* Hover
* Loading config from `root dir`
* Highlight color (use with [mrshmllow/document-color.nvim](https://github.com/mrshmllow/document-color.nvim))## Install
```sh
npm i unocss-language-server -g
```## Usage
[nvim-lspconfig server_configuration](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#unocss)
```lua
require 'lspconfig'.unocss.setup {
on_attach = on_attach,
capabilities = capabilities,
filetypes = { ... },
root_dir = function(fname)
return require 'lspconfig.util'.root_pattern(...)(fname)
end
}
```
If you are using [nvim-cmp](https://github.com/hrsh7th/nvim-cmp), you can add `-` to [trigger_characters](https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L528).
```lua
cmp.setup {
sources = { { name = 'nvim_lsp', trigger_characters = { '-' } } }
}
```
Because `@unocss/autocomplete` suggest less before meeting `-`.## Related information
* [Language Server Extension Guide](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide)
* [Language Server Protocol Specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/)
* [Lsp - Neovim docs](https://neovim.io/doc/user/lsp.html)