You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rascal-lsp/src/main/rascal/util/LanguageServer.rsc
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -160,12 +160,12 @@ alias Implementer = set[loc] (loc _origin, Tree _fullTree, Tree _lexicalAtCursor
160
160
Each LanguageService constructor provides one aspect of definining the language server protocol (LSP).
161
161
Their names coincide exactly with the services which are documented [here](https://microsoft.github.io/language-server-protocol/).
162
162
163
-
* The ((parsing)) service that maps source code strings to a ((Tree)) is essential and non-optional.
163
+
* The ((parsing)) service that maps source code strings to a ((ParseTree::Tree)) is essential and non-optional.
164
164
All other other services are optional.
165
-
* By providing a parser which produces annotated parse ((Tree))s, editor features such as parse error locations, syntax highlighting and
165
+
* By providing a parser which produces annotated parse ((ParseTree::Tree))s, editor features such as parse error locations, syntax highlighting and
166
166
selection assistance are immediately enabled.
167
167
* The ((parsing)) service is activated after every change in an editor document (when a suitable pause has occurred)
168
-
* All downstream services are based on the ((Tree)) that is produced here. In
168
+
* All downstream services are based on the ((ParseTree::Tree)) that is produced here. In
169
169
particular downstream services make use of the `src` origin fields that the parser must produce.
170
170
* Parsers can be obtained automatically using the ((ParseTree::parser)) or ((ParseTree::parsers)) functions, like so `parser(#start[Program])`.
171
171
Like this a fast parser is obtained that does not require a global interpreter lock. If you pass in a normal Rascal function, which is fine, the global
@@ -213,13 +213,13 @@ leaf all the way up to the root of the tree. This list helps to create functiona
213
213
programmer.
214
214
215
215
To start developing an LSP extension step-by-step:
216
-
1. first write a ((SyntaxDefinition)) in Rascal and register it via the ((parsing)) service. Use ((registerLanguage)) from the terminal ((REPL)) to
216
+
1. first write a SyntaxDefinition in Rascal and register it via the ((parsing)) service. Use ((registerLanguage)) from the terminal ((REPL)) to
217
217
test it immediately. Create some example files for your language to play around with.
218
218
2. either make an ((analysis)) service that produces a ((Summary)) _or_ start ((hover)), ((definition)), ((references)) and ((implementation))
219
219
lookup services. Each of those four services require the same information that is useful for filling a ((Summary)) with an ((analysis)) or a ((builder)).
220
220
3. the ((documentSymbol)) service is next, good for the outline view and also quick search features.
221
221
4. the to add interactive features, optionally ((inlayHint)), ((codeLens)) and ((codeAction)) can be created to add visible hooks in the UI to trigger
222
-
your own ((CodeAction))s and ((Commands))
222
+
your own ((CodeAction))s and Commands
223
223
* create an ((execution)) service to give semantics to each command. This includes creating ((DocumentEdit))s but also ((IDEServices))
224
224
can be used to have interesting effects in the IDE.
225
225
* ((CodeAction))s can also be attached to error, warning and into ((Message))s as a result of ((parsing)), ((analysis)) or ((util::LanguageServer::build)).
0 commit comments