Changes for page Running KEITH
Last modified by Richard Kreissig on 2023/09/14 08:48
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -73,7 +73,7 @@ 73 73 74 74 Install [[node 8>>url:https://nodejs.org/download/release/v8.15.0/||shape="rect"]] for windows. I personally used the {{code language="none"}}.msi{{/code}}. 75 75 76 -Use that to install windows-build-tools :76 +Use that to install windows-build-tools by executing the command in an administrative powershell. 77 77 78 78 {{code}} 79 79 npm install -g windows-build-tools ... ... @@ -81,6 +81,10 @@ 81 81 82 82 This installs make, gcc, g++, python and all this (I am not sure about yarn, anyway you can always install yarn the same way as in the linux description) 83 83 84 +=== Known Problems in this step === 85 + 86 +Python is not correctly registered in the path. 87 + 84 84 == ... on mac: == 85 85 86 86 Get a package manager, something like [[brew>>url:https://brew.sh/index_de||shape="rect"]]. ... ... @@ -201,12 +201,97 @@ 201 201 de.cau.cs.kieler.kicool.ide.language.server.KiCoolLanguageServerContribution 202 202 {{/code}} 203 203 204 -This 208 +This is the fully qualified name of the contribution written earlier. 205 205 210 +The language server uses all LanguageServerExtensions like this: 211 + 212 +{{code}} 213 +var iLanguageServerExtensions = <Object>newArrayList(languageServer) // list of all language server extensions 214 +for (lse : KielerServiceLoader.load(ILanguageServerContribution)) { // load all contributions 215 + iLanguageServerExtensions.add(lse.getLanguageServerExtension(injector)) 216 +} 217 +{{/code}} 218 + 219 +The resulting list of implementions is used to add the extensions to the language server. 220 + 206 206 == Register an extension (on server side) == 207 207 208 - ==Registeranextension(onclientside)==223 +See example above for ServiceLoader and initial stuff. 209 209 210 - ==Howtosend messages==225 +What is still missing are the contents of the CommandExtension implemented by the KiCoolLanguageServerExtension. This is an interface defining all additional commands. The CommandExtension looks like this. 211 211 227 +{{code}} 228 +package de.cau.cs.kieler.kicool.ide.language.server 229 + 230 +import java.util.concurrent.CompletableFuture 231 +import org.eclipse.lsp4j.jsonrpc.services.JsonRequest 232 +import org.eclipse.lsp4j.jsonrpc.services.JsonSegment 233 + 234 +/** 235 + * Interface to the LSP extension commands 236 + * 237 + * @author really fancy name 238 + * 239 + */ 240 +@JsonSegment('keith/kicool') 241 +interface CommandExtension { 242 + 243 + /** 244 + * Compiles file given by uri with compilationsystem given by command. 245 + */ 246 + @JsonRequest('compile') 247 + def CompletableFuture<CompilationResults> compile(String uri, String clientId, String command, boolean inplace); 248 + 249 + /** 250 + * Build diagram for snapshot with id index for file given by uri. Only works, if the file was already compiled. 251 + */ 252 + @JsonRequest('show') 253 + def CompletableFuture<String> show(String uri, String clientId, int index) 254 + 255 + /** 256 + * Returns all compilation systems which are applicable for the file at given uri. 257 + * 258 + * @param uri URI as string to get compilation systems for 259 + * @param filter boolean indicating whether compilation systems should be filtered 260 + */ 261 + @JsonRequest('get-systems') 262 + def CompletableFuture<Object> getSystems(String uri, boolean filterSystems) 263 +} 264 +{{/code}} 265 + 266 +This defines three json-rpc commands: "keith/kicool/compile", "keith/kicool/show", "keith/kicool/get-systems". These are implemented in KiCoolLanguageServerExtension. 267 + 268 +== Register and calling an extension (on client side) == 269 + 270 +Language server extension do not have to be registered on the client side. It is just called. 271 + 272 +You can send a request or a notification to the language server like this: 273 + 274 +{{code}} 275 +const lclient = await this.client.languageClient 276 +const snapshotsDescriptions: CodeContainer = await lclient.sendRequest("keith/kicool/compile", [uri, KeithDiagramManager.DIAGRAM_TYPE + '_sprotty', command, 277 + this.compilerWidget.compileInplace]) as CodeContainer 278 +// or via a thenable 279 +client.languageClient.then(lClient => { 280 +lClient.sendRequest("keith/kicool/compile").then((languages: LanguageDescription[]) => { 281 + // very important stuff 282 +} 283 +// await is preferred, since it is shorter. 284 +{{/code}} 285 + 286 +In this example client is an instance of a language client. It is usally injected like this: 287 + 288 +{{code}} 289 +constructor( 290 + @inject(KeithLanguageClientContribution) public readonly client: KeithLanguageClientContribution 291 + // other injected classes 292 + ) { 293 + // constructor stuff 294 +} 295 +{{/code}} 296 + 297 +\\ 298 + 299 +== How to make a new == 300 + 212 212 == How to write a widget ==
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -568525 251 +56852530 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/568525 25/Running KEITH1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/56852530/Running KEITH