<
From version < 10.1 >
edited by Soeren Domroes
on 2019/04/01 09:14
To version < 13.1 >
edited by Soeren Domroes
on 2019/04/01 13:53
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -16,7 +16,7 @@
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//. Run //clean build//. Several pragmatics projects have error. 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//. 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.
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,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"]].
... ... @@ -147,10 +147,24 @@
147 147  yarn && cd keith-app && yarn run socket
148 148  {{/code}}
149 149  
154 +//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.
155 +
150 150  Per default the KEITH opens on localhost:3000.
151 151  
152 152  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.
153 153  
160 +=== Known issues for windows: ===
161 +
162 +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.
163 +
164 +=== Known issues on mac: ===
165 +
166 +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.
167 +
168 +=== Known issues: ===
169 +
170 +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.
171 +
154 154  = Developing for KEITH =
155 155  
156 156  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:
... ... @@ -201,12 +201,139 @@
201 201  de.cau.cs.kieler.kicool.ide.language.server.KiCoolLanguageServerContribution
202 202  {{/code}}
203 203  
204 -This
222 +This is the fully qualified name of the contribution written earlier.
205 205  
224 +The language server uses all LanguageServerExtensions like this:
225 +
226 +{{code}}
227 +var iLanguageServerExtensions = <Object>newArrayList(languageServer) // list of all language server extensions
228 +for (lse : KielerServiceLoader.load(ILanguageServerContribution)) { // load all contributions
229 + iLanguageServerExtensions.add(lse.getLanguageServerExtension(injector))
230 +}
231 +{{/code}}
232 +
233 +The resulting list of implementions is used to add the extensions to the language server.
234 +
206 206  == Register an extension (on server side) ==
207 207  
208 -== Register an extension (on client side) ==
237 +See example above for ServiceLoader and initial stuff.
209 209  
210 -== How to send messages ==
239 +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  
241 +{{code}}
242 +package de.cau.cs.kieler.kicool.ide.language.server
243 +
244 +import java.util.concurrent.CompletableFuture
245 +import org.eclipse.lsp4j.jsonrpc.services.JsonRequest
246 +import org.eclipse.lsp4j.jsonrpc.services.JsonSegment
247 +
248 +/**
249 + * Interface to the LSP extension commands
250 + *
251 + * @author really fancy name
252 + *
253 + */
254 +@JsonSegment('keith/kicool')
255 +interface CommandExtension {
256 +
257 + /**
258 + * Compiles file given by uri with compilationsystem given by command.
259 + */
260 + @JsonRequest('compile')
261 + def CompletableFuture<CompilationResults> compile(String uri, String clientId, String command, boolean inplace);
262 +
263 + /**
264 + * Build diagram for snapshot with id index for file given by uri. Only works, if the file was already compiled.
265 + */
266 + @JsonRequest('show')
267 + def CompletableFuture<String> show(String uri, String clientId, int index)
268 +
269 + /**
270 + * Returns all compilation systems which are applicable for the file at given uri.
271 + *
272 + * @param uri URI as string to get compilation systems for
273 + * @param filter boolean indicating whether compilation systems should be filtered
274 + */
275 + @JsonRequest('get-systems')
276 + def CompletableFuture<Object> getSystems(String uri, boolean filterSystems)
277 +}
278 +{{/code}}
279 +
280 +This defines three json-rpc commands: "keith/kicool/compile", "keith/kicool/show", "keith/kicool/get-systems". These are implemented in KiCoolLanguageServerExtension.
281 +
282 +== Register and calling an extension (on client side) ==
283 +
284 +Language server extension do not have to be registered on the client side. It is just called.
285 +
286 +You can send a request or a notification to the language server like this:
287 +
288 +{{code}}
289 +const lclient = await this.client.languageClient
290 +const snapshotsDescriptions: CodeContainer = await lclient.sendRequest("keith/kicool/compile", [uri, KeithDiagramManager.DIAGRAM_TYPE + '_sprotty', command,
291 + this.compilerWidget.compileInplace]) as CodeContainer
292 +// or via a thenable
293 +client.languageClient.then(lClient => {
294 +lClient.sendRequest("keith/kicool/compile").then((snapshotsDescriptions: CodeContainer) => {
295 + // very important stuff
296 +}
297 +// await is preferred, since it is shorter.
298 +{{/code}}
299 +
300 +In this example client is an instance of a language client. It is usually injected like this:
301 +
302 +{{code}}
303 +constructor(
304 + @inject(KeithLanguageClientContribution) public readonly client: KeithLanguageClientContribution
305 + // other injected classes
306 + ) {
307 + // constructor stuff
308 +}
309 +{{/code}}
310 +
311 +\\
312 +
313 +== How to make a new package for KEITH ==
314 +
315 +Clone the [[KEITH repository>>url:https://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/keith/browse||shape="rect"]].
316 +
317 +Open the keith folder in VSCode. You are know in the keith directory in VSCode.
318 +
319 +You see something like this: TODO picture
320 +
321 +Create a new folder called keith-<your extension name>.
322 +
323 +Copy a package.json, a tslint.json, a tsconfig.json, and a src folder into the folder.
324 +
325 +Add keith-<your extension name> to workspaces in the top level package.json.
326 +
327 +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).
328 +
329 +=== What is in the src directory? ===
330 +
331 +The source directory has three optional subfolders.
332 +
333 +* 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"]].
334 +* common: Holds general helper methods, string constants and some data classes
335 +* browser: Holds all widgets, contribution for commands, menus, and widgets, and the frontend-extension.
336 +
337 +==== The frontend-extension ====
338 +
339 +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.
340 +
341 +==== More examples for stuff ====
342 +
343 +See [[Theia examples>>url:https://www.theia-ide.org/doc/Commands_Keybindings.html||shape="rect"]].
344 +
212 212  == How to write a widget ==
346 +
347 +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"]].
348 +
349 +* BaseWidget: Very basic
350 +* ReactWidget: A render method has to be implemented that redraws the widget on demand. Additionally several on* event methods can beimplemented.
351 +* TreeWidget: Extends the ReactWidget and draws the contents of the widget in a tree view.
352 +
353 +If a widget has a state it should implement the StatefulWidget interface, which allows to imlement a store and restore method.
354 +
355 +Look at examples in KEITH or Theia to see how this is done.
356 +
357 +\\
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -56852525
1 +56852532
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/56852525/Running KEITH
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/56852532/Running KEITH