miniscript-languageserver 1.4.8 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -24
- package/index.js +89 -89
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
# miniscript-languageserver
|
2
2
|
|
3
|
-
|
3
|
+
[](https://circleci.com/gh/ayecue/miniscript-languageserver)
|
4
4
|
|
5
|
-
|
5
|
+
`miniscript-languageserver` is a Language Server for MiniScript that offers a variety of features, including:
|
6
6
|
|
7
|
-
|
7
|
+
- Auto-completion
|
8
|
+
- Hover tooltips
|
9
|
+
- Syntax highlighting and more
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
17
|
-
-
|
18
|
-
-
|
11
|
+
This language server is compatible with any client that follows the [LSP standards](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide).
|
12
|
+
|
13
|
+
For an example of how it integrates with a popular editor, take a look at the [examples](#example-implementations).
|
14
|
+
|
15
|
+
## Supported Providers
|
16
|
+
|
17
|
+
`miniscript-languageserver` supports the following language server protocol (LSP) features:
|
18
|
+
|
19
|
+
- **Completion**: Auto-completion suggestions for code.
|
20
|
+
- **Hover**: Displays information about a symbol when you hover over it.
|
21
|
+
- **Color**: Color information for syntax highlighting and theming.
|
22
|
+
- **Definition**: Navigate to the definition of a symbol.
|
23
|
+
- **Formatter**: Automatically format the code according to set rules.
|
24
|
+
- **Signature Help**: Shows function or method signatures while typing.
|
25
|
+
- **Document Symbol**: Lists all symbols in a document (e.g., functions, classes).
|
26
|
+
- **Workspace Symbol**: Search for symbols across the workspace.
|
27
|
+
- **Diagnostic**: Provides error, warning, and information diagnostics.
|
28
|
+
- **Semantic Tokens**: Enhanced token classification for syntax highlighting and analysis.
|
19
29
|
|
20
30
|
## Install
|
21
31
|
|
@@ -28,9 +38,20 @@ npm install -g miniscript-languageserver
|
|
28
38
|
miniscript-languageserver
|
29
39
|
```
|
30
40
|
|
31
|
-
## Example
|
41
|
+
## Example Implementations
|
42
|
+
|
43
|
+
This section provides a collection of IDEs that implement the `miniscript-languageserver`.
|
44
|
+
|
45
|
+
- [VSCode](#vscode): Visual Studio Code setup for `miniscript-languageserver`.
|
46
|
+
- [Sublime Text](#sublime): Instructions for integrating with Sublime Text.
|
47
|
+
- [IntelliJ](#intellij): Guide for using `miniscript-languageserver` with IntelliJ.
|
48
|
+
- [Neovim (nvim)](#nvim): Configuration for Neovim users.
|
49
|
+
|
50
|
+
Any other IDEs that follow the [LSP standards](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide) should also work with `miniscript-languageserver`.
|
32
51
|
|
33
|
-
#### VSCode
|
52
|
+
#### VSCode
|
53
|
+
|
54
|
+
1. Create language client file.
|
34
55
|
```ts
|
35
56
|
import * as path from 'path';
|
36
57
|
import {
|
@@ -67,8 +88,10 @@ client.registerProposedFeatures();
|
|
67
88
|
client.start();
|
68
89
|
```
|
69
90
|
|
70
|
-
#### Sublime
|
71
|
-
|
91
|
+
#### Sublime
|
92
|
+
|
93
|
+
1. Install the [LSP Package](https://lsp.sublimetext.io/) from the Sublime Text Package Control.
|
94
|
+
2. Create the following LSP client configuration in your Sublime settings:
|
72
95
|
```json
|
73
96
|
{
|
74
97
|
"show_diagnostics_panel_on_save": 0,
|
@@ -78,11 +101,12 @@ Install [LSP Package](https://lsp.sublimetext.io/) and create the following conf
|
|
78
101
|
"command": ["miniscript-languageserver", "--stdio"],
|
79
102
|
"selector": "source.miniscript"
|
80
103
|
}
|
81
|
-
}
|
104
|
+
},
|
105
|
+
"semantic_highlighting": true
|
82
106
|
}
|
83
107
|
```
|
84
108
|
|
85
|
-
|
109
|
+
3. Create a Sublime syntax file for miniscript. The highlighting will be provided via the semantic provider, so there's no need to add additional patterns here. Use the following configuration:
|
86
110
|
```yaml
|
87
111
|
%YAML 1.2
|
88
112
|
---
|
@@ -97,14 +121,77 @@ contexts:
|
|
97
121
|
scope: text.miniscript
|
98
122
|
```
|
99
123
|
|
100
|
-
|
124
|
+
#### IntelliJ
|
125
|
+
|
126
|
+
To set up `miniscript-languageserver` in IntelliJ, follow these steps:
|
127
|
+
|
128
|
+
1. [Install miniscript-languageserver](#install).
|
129
|
+
2. Install the `LSP4IJ` plugin from the JetBrains Plugin Marketplace.
|
130
|
+
3. Go to **Languages & Frameworks > Language Servers**.
|
131
|
+
4. Click the "+" icon to add a new language server configuration.
|
132
|
+
5. In the **Name** field, enter `miniscript`.
|
133
|
+
6. In the **Command** field, enter `miniscript-languageserver --stdio`.
|
134
|
+
7. In the **Filename Patterns** section:
|
135
|
+
- Set **File Name Pattern** to `*.src`.
|
136
|
+
- Set **Language Id** to `miniscript`.
|
137
|
+
8. Restart IntelliJ.
|
138
|
+
|
139
|
+
You should now have `miniscript-languageserver` set up and ready to use with IntelliJ.
|
140
|
+
|
141
|
+
|
142
|
+
#### nvim
|
143
|
+
|
144
|
+
1. Add the following configuration to your `init.vim`:
|
145
|
+
```vim
|
146
|
+
" Install vim-plug if it's not already installed
|
147
|
+
call plug#begin('~/.vim/plugged')
|
148
|
+
|
149
|
+
" Install LSP config plugin
|
150
|
+
Plug 'neovim/nvim-lspconfig'
|
151
|
+
|
152
|
+
call plug#end()
|
153
|
+
|
154
|
+
" LSP configuration for miniscript-languageserver
|
155
|
+
lua <<EOF
|
156
|
+
local configs = require'lspconfig.configs'
|
157
|
+
local lspconfig = require'lspconfig'
|
158
|
+
|
159
|
+
-- Enable debug-level logging
|
160
|
+
vim.lsp.set_log_level("debug")
|
161
|
+
|
162
|
+
if not configs.miniscript then
|
163
|
+
configs.miniscript = {
|
164
|
+
default_config = {
|
165
|
+
cmd = { "miniscript-languageserver", "--stdio" },
|
166
|
+
filetypes = { "src" },
|
167
|
+
root_dir = lspconfig.util.root_pattern(".git", vim.fn.getcwd()),
|
168
|
+
settings = {},
|
169
|
+
on_attach = function(client, bufnr) -- Optional on_attach function
|
170
|
+
-- Set up hover keybinding here
|
171
|
+
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', { noremap = true, silent = true })
|
172
|
+
end,
|
173
|
+
},
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
-- Register and start the miniscript LSP
|
178
|
+
lspconfig.miniscript.setup{}
|
179
|
+
EOF
|
180
|
+
|
181
|
+
autocmd BufRead,BufNewFile *.src set filetype=src
|
182
|
+
```
|
183
|
+
2. Don't forget to run :PlugInstall to install the necessary plugins.
|
184
|
+
|
185
|
+
This configuration ensures that miniscript-languageserver will be properly integrated into Neovim, and that .src files will be recognized with the correct syntax highlighting and LSP features.
|
186
|
+
|
187
|
+
## How to Add Tooltips
|
101
188
|
|
102
|
-
|
103
|
-
- create a PR with your changes in the [meta repository](https://github.com/ayecue/miniscript-meta)
|
104
|
-
- create a PR with the raised version to this repository
|
189
|
+
Tooltips in `miniscript-languageserver` can help provide additional context, such as method descriptions, to users. You can contribute your own tooltips by following this workflow:
|
105
190
|
|
106
|
-
|
191
|
+
1. Fork and create a pull request (PR) with your changes to the [miniscript-meta repository](https://github.com/ayecue/miniscript-meta), where the meta descriptions are stored.
|
192
|
+
2. Once your changes are merged, create a separate PR in this repository to update the version of `miniscript-languageserver` to include the new meta descriptions.
|
107
193
|
|
194
|
+
Additionally, you can define method-specific tooltips directly in the code using comments. This allows for quick, tooltips for individual methods.
|
108
195
|
```js
|
109
196
|
// @type Bar
|
110
197
|
// @property {string} virtualMoo
|