Giter Club home page Giter Club logo

typescript-lsp-poc's Introduction

typescript-lsp-poc

🗣 monaco-editor is the code editor which powers VS Code, with the features better described here.

Getting Started

fnm use
npm install
npm run build

What?

LSP can be directly integrated into monaco.

Instead of monaco getting its Typescript intellisense from the webworker it bootstraps, it will get it over a Web Socket from a Language Server.

What’s bad with monaco’s TS webworker?

The webworker monaco uses is a limited Typescript language client. The language client can understand only the current file, and cannot analyze the entire project. For example, this means it cannot know where an implementation of a function is, if it’s in a different file.

Execution Plan

  • Start the Typescript language server locally
  • Register monaco providers (completions provider etc.) using something like the monaco-languageclient and monaco-jsonrpc libraries
    • When a message arrives over the WebSocket, the message will be parsed by the relevant provider
    • E.g. the LSP sends a message saying there are 5 errors in the file → the errors provider will be triggered, adding the errors to monaco
  • Deploy the grid app files on the same server and feed them into the language server

Stretch goal

  • Understand how multiple language servers can be hooked into monaco with something like json-ws-proxy

POC Open Questions

Hopefully by the end of the POC we will have answers to these questions:

  • What’s the backend effort of this task?
  • How will you sync the user’s changes to the grid app?
  • Can typescript-language-server work against remote files?

Resources

typescript-lsp-poc's People

Contributors

dlvhdr avatar

Stargazers

Roman avatar Jonathan Carlson avatar

Watchers

 avatar  avatar

Forkers

manikantag

typescript-lsp-poc's Issues

Not getting intellisense from workspace files

Hi,

I'm also doing a POC to integrate monaco-editor to support TypeScript. I tried out-of-box monaco Web worker language service, but it the perf is very poor when I load 2000 .ts models (more on this here: https://stackoverflow.com/questions/73936684/performant-way-to-load-2000-ts-models-into-monaco-editor-for-intellisense).

Now I'm trying to see if running language server in its own process makes it any better. I came across your POC, but I can't see intellsense from the files in workspace (ex: I've added dummy() to statics/pages/test.ts but I can't get that in auto complete in pages/home.ts)

I updated below npm modules to latest ones:

client:

  • @codingame/monaco-jsonrpc => vscode-ws-jsonrpc 2.0.0
  • monaco-editor 0.33.0 => monaco-editor 0.34.0
  • monaco-editor-workers 0.33.0 => 0.34.0
  • monaco-languageclient 2.0.2 => 4.0.0

server:

  • @codingame/monaco-jsonrpc => vscode-ws-jsonrpc 2.0.0
  • typescript-language-server 0.10.1 => typescript-language-server 2.0.0
  • ws 8.6.0 => ws 8.9.0

I fixed all compatibility issue with new versions, especially monaco-languageclient ESM upgrade caused major issue.

But still I don't see auto complete from the workspace files.

Am I missing something? Any help is much appreciated. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.