Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
api-language-server
Advanced tools
A Language Server that exposes smart RAML language support for various IDEs using the new Language Server Protocol standard.
This project exposes not only the RAML JS parser but also functionalities that are currently part of the API Workbench Atom package as a Language Server.
RAML Server joins all the services and provides them as an interface with maximum simplicity. No RAML parser AST goes out from the LSP server. The LSP server has the full control of when and how RAML is parsed. The clients should not care about these details.
The supported clients are divided into 3 types, by the type of the way the client launches the server and the environment, the server is executed in. For each type of the launch/environment we add its own supporting code, which should only care about the details of launch/transport. No business logics of how to handle RAML is located in there.
Node-based
This type of launch expects the client and the server to be running in node.js. An example is the API Worbench.
Web worker-based
This type of launch expects the client to be running in the browser, and the server to be running in web worker. An example is the Monaco-based editor.
MS LSP
This type of launch expects the client to be running in the unknown environment, which supports MS LSP, and the server to be running in node.js. This allows to potentially support lots of current IDEs. An example is the VS Code plug-in. Note: each additional LSP client requires its own code, but that code is thin.
No client module directly depends on the service modules or parser modules. The only point of connection for the clients is the server itself.
Server module contains the following major parts:
Most of the features available in the Language Server Protocol and VSCode Extensions have already been developed and battle tested in the API Workbench Atom package.
We are currently working on extracting these features as stand-alone components that can be used to implement the LSP server.
There are a number of server modules, each providing a feature and, supposedly, binding on one or more of client connection methods.
The current list of modules, which is going to expand:
Modules are located in src/server/modules
folder and its subfolders.
More details of how to use the client are here
An interface for this client is custom and simple. It contains a single method per major functionality feature.
In example, client can notify the server that a document was opened by calling a method:
/**
* Notifies the server that document is opened.
* @param document
*/
documentOpened(document: IOpenedDocument);
Where IOpenedDocument
has only two fields: document URI and document text.
And get notified about new validation reports from the server by adding a listener:
/**
* Adds a listener for validation report coming from the server.
* @param listener
*/
onValidationReport(listener : (report:IValidationReport)=>void);
Or finding references by calling:
/**
* Requests server for the positions of the references of the element defined
* at the given document position.
* @param uri - document uri
* @param position - position in the document
*/
findReferences(uri: string, position: number) : Promise<ILocation[]>
It is possible that further along the road some data interfaces will change by receiving new fields, but the simplicity should be preserved.
Note the an emitter of an event can be both client and server. In example, client does not ask server for validation report, instead server notifies client that the new report is ready when the server has time to parse RAML and collection validation data. Server decides when and how to parse RAML and update IDE-related data, client can either subscribe to events, or ask for immediate/fast (but potentially outdated) results stored at the server.
Server implements node-based launching, a transport that transfers client/server calls via node messages and provides a single simple method, which launches the server and returns an instance of client connection.
More details of how to use the client are here
This type of client uses the same client interface as node-based client for unification.
Launching should handle web-worker related functionality and contain a simple method to launch the worker and return client connection. All transport should be handled by this type of launching and hidden from the client.
This is also the place where the “universal” server data like structure is converted to this particular client’s terms like outline if needed.
More details of how to use the client are here
This type of client has no client interface because this is something handled by the standard LSP clients, at least until we decide to extend what MS LSP currently provides.
Launching is represented by the proper LSP config, it is supposed that the client simply adds raml-language-client to dependencies list and refers it as a server module. For non-node clients it can be harder.
Communication is handled as server part by converting MS LSP server calls/data to/from server interface calls/data. This is also the place where the “universal” server data like structure is converted to this particular client’s terms like symbols if needed.
More details of how add to develop the server side are here
Server interface is represented by the server connection and is something server business logics communicates to in order to provide its functionality to the clients. It resembles the client one for node-based clients:
Get knowing about document being opened:
/**
* Adds a listener to document open notification. Must notify listeners in order of registration.
* @param listener
*/
onOpenDocument(listener: (document: IOpenedDocument)=>void);
Notifying the client about new validation report:
/**
* Reports latest validation results
* @param report
*/
validated(report:IValidationReport) : void;
Finding the references by the client request and letting the client know the results:
/**
* Adds a listener to document find references request. Must notify listeners in order of registration.
* @param listener
*/
onFindReferences(listener: (uri: string, position: number) => ILocation[])
In the current implementation prototype server interface is located in src/server/core/connections.ts
file IServerConnection
interface, implementation is located in src/server/core
folder.
If you are interested in contributing some code to this project, thanks! Please first read and accept the Contributors Agreement.
To discuss this project, please use its github issues or the RAML forum.
FAQs
Language Server based on the Language Server Protocol
The npm package api-language-server receives a total of 1 weekly downloads. As such, api-language-server popularity was classified as not popular.
We found that api-language-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.