Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use that to install windows-build-tools :by executing the command in an administrative powershell.

Code Block
npm install -g windows-build-tools

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)

Known Problems in this step

Python is not correctly registered in the path.

... on mac:

Get a package manager, something like brew.

...

Code Block
de.cau.cs.kieler.kicool.ide.language.server.KiCoolLanguageServerContribution

This is the fully qualified name of the contribution written earlier.

The language server uses all LanguageServerExtensions like this:

Code Block
var iLanguageServerExtensions = <Object>newArrayList(languageServer) // list of all language server extensions
for (lse : KielerServiceLoader.load(ILanguageServerContribution)) { // load all contributions
	iLanguageServerExtensions.add(lse.getLanguageServerExtension(injector))
}

The resulting list of implementions is used to add the extensions to the language server.

Register an extension (on server side)

See example above for ServiceLoader and initial stuff.

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.

Code Block
package de.cau.cs.kieler.kicool.ide.language.server

import java.util.concurrent.CompletableFuture
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest
import org.eclipse.lsp4j.jsonrpc.services.JsonSegment

/**
 * Interface to the LSP extension commands
 * 
 * @author really fancy name
 *
 */
@JsonSegment('keith/kicool')
interface CommandExtension {
    
    /**
     * Compiles file given by uri with compilationsystem given by command.
     */
    @JsonRequest('compile')
    def CompletableFuture<CompilationResults> compile(String uri, String clientId, String command, boolean inplace);
    
    /**
     * Build diagram for snapshot with id index for file given by uri. Only works, if the file was already compiled.
     */
    @JsonRequest('show')
    def CompletableFuture<String> show(String uri, String clientId, int index)
    
    /**
     * Returns all compilation systems which are applicable for the file at given uri.
     * 
     * @param uri URI as string to get compilation systems for
     * @param filter boolean indicating whether compilation systems should be filtered
     */
    @JsonRequest('get-systems')
    def CompletableFuture<Object> getSystems(String uri, boolean filterSystems)
}

This defines three json-rpc commands: "keith/kicool/compile", "keith/kicool/show", "keith/kicool/get-systems". These are implemented in KiCoolLanguageServerExtension.

Register and calling an extension (on client side)

Language server extension do not have to be registered on the client side. It is just called.

You can send a request or a notification to the language server like this:

Code Block
const lclient = await this.client.languageClient
const snapshotsDescriptions: CodeContainer = await lclient.sendRequest("keith/kicool/compile", [uri, KeithDiagramManager.DIAGRAM_TYPE + '_sprotty', command,
	this.compilerWidget.compileInplace]) as CodeContainer
// or via a thenable


How to send messages

How to write a widget