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
-
... ... @@ -8,15 +8,15 @@ 8 8 9 9 For everything not mentioned here refer to [[Getting Eclipse>>doc:KIELER.Getting Eclipse||shape="rect"]] guide. 10 10 11 -Use the installer go to advanced mode, add the KIELER url. Then select first pragmatics and after that semantics ( **that is very****important**).11 +Use the installer go to advanced mode, add the KIELER url. Then select first pragmatics and after that semantics (that is very important). 12 12 13 -Select the Theia stream for semantics and the Keith stream for pragmatics and use the latest eclipse if possible. Set the targetplatform to photon (or latest?) and finish.13 +Select the Theia stream for semantics and the Keith stream for pragmatics and use the latest eclipse if possible. Set the targetplatform to photon and finish. 14 14 15 15 Wait till everything installs and the setup tasks finish. If you have any problems in this stage refer to the [[Getting Eclipse>>doc:KIELER.Getting Eclipse||shape="rect"]] guide. 16 16 17 17 \\ 18 18 19 -The setup tasks for Modular Target will fail. Disable it after this happens and execute them again via //Help>Perform Setup Tasks//. Open the //plug-in development// perspective. Select working sets as top level elements.Run //clean build//. Several pragmatics projects have errors. Just close them and you will be fine.19 +The setup tasks for Modular Target will fail. Disable it after this happens and execute them again via //Help>Perform Setup Tasks//. Run //clean build//. Several pragmatics projects have error. Just close them and you will be fine. 20 20 21 21 To run the language server go to //Run Configurations// create a new //eclipse application// run configuration and select //Run an application// and //de.cau.cs.kieler.language.server.LanguageServer// 22 22 ... ... @@ -73,22 +73,14 @@ 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 by executing the command in an administrative powershell.76 +Use that to install windows-build-tools: 77 77 78 78 {{code}} 79 79 npm install -g windows-build-tools 80 80 {{/code}} 81 81 82 -This installs make, gcc, g++, python and all this .Somehowthis doesnot reallyterminate. If nothinghappensanymoreitmaybe finished, justkill theprocessifitdoesnotterminate.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 -All the installed executables are not in the path and that is okay. This is not needed since yarn/npm knows how to call them when needed. 85 - 86 -Yarn can be downloaded and installed from [[here>>url:https://yarnpkg.com/lang/en/docs/install/#windows-stable||shape="rect"]]. 87 - 88 -=== Known Problems in this step === 89 - 90 -If python3 was already installed this may cause some problems. 91 - 92 92 == ... on mac: == 93 93 94 94 Get a package manager, something like [[brew>>url:https://brew.sh/index_de||shape="rect"]]. ... ... @@ -155,24 +155,10 @@ 155 155 yarn && cd keith-app && yarn run socket 156 156 {{/code}} 157 157 158 -//yarn// builds all the stuff. //yarn run socket// in keith-app starts the application. After an initial build via yarn you can run //yarn watch // to watch the changes in your repository. In another console you run yarn run socket in keith-app. Now refreshing your browser is enough to apply the changes. 159 - 160 160 Per default the KEITH opens on localhost:3000. 161 161 162 162 It is required to restart the language server if KEITH is restarted, since the diagram view has a problem (since theia-sprotty is used) to reconnect after that. 163 163 164 -=== Known issues for windows: === 165 - 166 -nsfw.code not found: In the top level package.json exists a script called postinstall. Remove this on windows, delete the node_modules folder and rebuilt the application. This is a known issue of electron-builder. 167 - 168 -=== Known issues on mac: === 169 - 170 -Since SWT is still used as part of the diagram synthesis (but is not relevant anymore). Since it is not called on the main thread this causes a deadlock. Therefore mac just does not work. 171 - 172 -=== Known issues: === 173 - 174 -Refreshing the browser is not enough for the diagram to work. If the diagram is needed the language server has to be restarted before the browser is refreshed. This is a known issue in theia-sprotty. 175 - 176 176 = Developing for KEITH = 177 177 178 178 We use java ServiceLoader to register stuff. Here is a small example how a LanguageServerExtension is registered via a ServiceLoader and how it is used: ... ... @@ -223,139 +223,12 @@ 223 223 de.cau.cs.kieler.kicool.ide.language.server.KiCoolLanguageServerContribution 224 224 {{/code}} 225 225 226 -This is the fully qualified name of the contribution written earlier.204 +This 227 227 228 -The language server uses all LanguageServerExtensions like this: 229 - 230 -{{code}} 231 -var iLanguageServerExtensions = <Object>newArrayList(languageServer) // list of all language server extensions 232 -for (lse : KielerServiceLoader.load(ILanguageServerContribution)) { // load all contributions 233 - iLanguageServerExtensions.add(lse.getLanguageServerExtension(injector)) 234 -} 235 -{{/code}} 236 - 237 -The resulting list of implementions is used to add the extensions to the language server. 238 - 239 239 == Register an extension (on server side) == 240 240 241 - Seeexample abovefor ServiceLoaderandinitialstuff.208 +== Register an extension (on client side) == 242 242 243 - Whatisstillmissing arethe contents of the CommandExtensionimplemented by the KiCoolLanguageServerExtension. Thisisan interface definingall additional commands. TheCommandExtensionlooks like this.210 +== How to send messages == 244 244 245 -{{code}} 246 -package de.cau.cs.kieler.kicool.ide.language.server 247 - 248 -import java.util.concurrent.CompletableFuture 249 -import org.eclipse.lsp4j.jsonrpc.services.JsonRequest 250 -import org.eclipse.lsp4j.jsonrpc.services.JsonSegment 251 - 252 -/** 253 - * Interface to the LSP extension commands 254 - * 255 - * @author really fancy name 256 - * 257 - */ 258 -@JsonSegment('keith/kicool') 259 -interface CommandExtension { 260 - 261 - /** 262 - * Compiles file given by uri with compilationsystem given by command. 263 - */ 264 - @JsonRequest('compile') 265 - def CompletableFuture<CompilationResults> compile(String uri, String clientId, String command, boolean inplace); 266 - 267 - /** 268 - * Build diagram for snapshot with id index for file given by uri. Only works, if the file was already compiled. 269 - */ 270 - @JsonRequest('show') 271 - def CompletableFuture<String> show(String uri, String clientId, int index) 272 - 273 - /** 274 - * Returns all compilation systems which are applicable for the file at given uri. 275 - * 276 - * @param uri URI as string to get compilation systems for 277 - * @param filter boolean indicating whether compilation systems should be filtered 278 - */ 279 - @JsonRequest('get-systems') 280 - def CompletableFuture<Object> getSystems(String uri, boolean filterSystems) 281 -} 282 -{{/code}} 283 - 284 -This defines three json-rpc commands: "keith/kicool/compile", "keith/kicool/show", "keith/kicool/get-systems". These are implemented in KiCoolLanguageServerExtension. 285 - 286 -== Register and calling an extension (on client side) == 287 - 288 -Language server extension do not have to be registered on the client side. It is just called. 289 - 290 -You can send a request or a notification to the language server like this: 291 - 292 -{{code}} 293 -const lclient = await this.client.languageClient 294 -const snapshotsDescriptions: CodeContainer = await lclient.sendRequest("keith/kicool/compile", [uri, KeithDiagramManager.DIAGRAM_TYPE + '_sprotty', command, 295 - this.compilerWidget.compileInplace]) as CodeContainer 296 -// or via a thenable 297 -client.languageClient.then(lClient => { 298 -lClient.sendRequest("keith/kicool/compile").then((snapshotsDescriptions: CodeContainer) => { 299 - // very important stuff 300 -} 301 -// await is preferred, since it is shorter. 302 -{{/code}} 303 - 304 -In this example client is an instance of a language client. It is usually injected like this: 305 - 306 -{{code}} 307 -constructor( 308 - @inject(KeithLanguageClientContribution) public readonly client: KeithLanguageClientContribution 309 - // other injected classes 310 - ) { 311 - // constructor stuff 312 -} 313 -{{/code}} 314 - 315 -\\ 316 - 317 -== How to make a new package for KEITH == 318 - 319 -Clone the [[KEITH repository>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/keith/browse||shape="rect"]]. 320 - 321 -Open the keith folder in VSCode. You are know in the keith directory in VSCode. 322 - 323 -You see something like this: TODO picture 324 - 325 -Create a new folder called keith-<your extension name>. 326 - 327 -Copy a package.json, a tslint.json, a tsconfig.json, and a src folder into the folder. 328 - 329 -Add keith-<your extension name> to workspaces in the top level package.json. 330 - 331 -Add "keith-<your extension name>(% style="color: rgb(0,0,0);" %)": (%%)"0.1.0"(% style="color: rgb(0,0,0);" %) to the dependencies in the top level package.json and the product package.json files (e.g. the package.json in keith-app). 332 - 333 -=== What is in the src directory? === 334 - 335 -The source directory has three optional subfolders. 336 - 337 -* node: Holds all backend related classes. This does currently only exist in the [[keith-language package>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/keith/browse/keith-language||shape="rect"]]. 338 -* common: Holds general helper methods, string constants and some data classes 339 -* browser: Holds all widgets, contribution for commands, menus, and widgets, and the frontend-extension. 340 - 341 -==== The frontend-extension ==== 342 - 343 -This binds all necessary classes. Look at existing frontend extension in [[KEITH>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/keith/browse||shape="rect"]] or [[Theia>>url:https://github.com/theia-ide/theia/tree/master/packages||shape="rect"]] to see how this is done. 344 - 345 -==== More examples for stuff ==== 346 - 347 -See [[Theia examples>>url:https://www.theia-ide.org/doc/Commands_Keybindings.html||shape="rect"]]. 348 - 349 349 == How to write a widget == 350 - 351 -There are different kinds of widgets that are commonly used in [[KEITH>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/keith/browse||shape="rect"]] or in existing [[Theia packages>>url:https://github.com/theia-ide/theia/tree/master/packages||shape="rect"]]. 352 - 353 -* BaseWidget: Very basic 354 -* ReactWidget: A render method has to be implemented that redraws the widget on demand. Additionally several on* event methods can beimplemented. 355 -* TreeWidget: Extends the ReactWidget and draws the contents of the widget in a tree view. 356 - 357 -If a widget has a state it should implement the StatefulWidget interface, which allows to imlement a store and restore method. 358 - 359 -Look at examples in KEITH or Theia to see how this is done. 360 - 361 -\\
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -568525 361 +56852525 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/568525 36/Running KEITH1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/56852525/Running KEITH