Skip to content

An attempt at extracting generic parts for implementing language servers for vscode

License

Notifications You must be signed in to change notification settings

vladdu/vscode-generic-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status MIT license

Overview

The LSP servers implemented by Microsoft use the same base structure (simplified): a cache for the parsed documents and a dispatcher to a "language service". Except for the latter, these are quite generic and I think they could be published as such, so that other implementors only need to implement the language service (unless they need something more advanced or entirely different).

My plan is to submit this to vscode once it is stable enough.

Using this module in other modules

Here is a quick example of how this module can be used in other modules. The file src/index.ts is a barrel that re-exports selected exports from other files. The package.json file contains main attribute that points to the generated lib/index.js file and typings attribute that points to the generated lib/index.d.ts file.

If you are planning to have code in multiple files (which is quite natural for a NodeJS module) that users can import, make sure you update src/index.ts file appropriately.

Now assuming you have published this amazing module to npm with the name my-amazing-lib, and installed it in the module in which you need it -

  • To use the Greeter class in a TypeScript file -
import { Greeter } from "my-amazing-lib";

const greeter = new Greeter("World!");
greeter.greet();
  • To use the Greeter class in a JavaScript file -
const Greeter = require('my-amazing-lib').Greeter;

const greeter = new Greeter('World!');
greeter.greet();

About

An attempt at extracting generic parts for implementing language servers for vscode

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published