question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Split the language server in its own npm module

See original GitHub issue

Ciao!

I got the language server working in VIM! Very fun! I didn’t push anything in my repo gianarb/vim-coc yet because I didn’t figure out how to release it yet.

Screenshot 2020-11-01 at 13 04 25

Let me explain my point here to see if you can help me. One of the plugins available in VIM to speak with an LSP is vim-coc that embeds the vscode language server client in VIM. It means that I had to create a bridge similar to this one, in order to make vim smart enough to start and talk with your Grammarly LSP. It works just fine.

import {ExtensionContext, services, workspace, LanguageClient, TransportKind} from 'coc.nvim'

export async function activate(context: ExtensionContext): Promise<void> {
  const serverOptions = {
    module: "/Users/gianarb/git/grammarly/out/server.js",
    transport: TransportKind.ipc,
    options: {
      cwd: workspace.root,
    }
  }
  const clientOptions = {
    documentSelector: ['markdown', 'md'],
  }
  const client = new LanguageClient(
    'coc-grammarly', // the id
    'coc-grammarly', // the name of the language server
    serverOptions,
    clientOptions
  )
  context.subscriptions.push(services.registLanguageClient(client))
}

Obviously /Users/gianarb/git/grammarly/out/server.js is a problem. Other projects like the css-language-server developed by Microsoft don’t have the extension and the LS in the same project, and it is easier for other editors to re-use it. My hope is that having the Grammarly-lsp as a standalone project with only the dependencies it needs will make it easier to reuse.

https://github.com/microsoft/vscode-css-languageservice

Does it sound reasonable to you? 😃 Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
marcoaaguiarcommented, Nov 25, 2020

For anyone that ends up here like me: @gianarb published and coc extension on gianarb/coc-grammarly

1reaction
znckcommented, Nov 16, 2020

There was a bug in the build config, fixed in https://github.com/znck/grammarly/commit/9ce4485821bfd35ae97cfb53a8d55d6627731507. It should work now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

purescript-language-server - npm
The language server is a wrapper around the IDE server included as part of the compiler distribution, providing editing assistance and build ...
Read more >
microsoft/vscode-languageserver-node: Language server ...
split code into common, node and browser to allow using the LSP client and server npm modules in a Web browser via webpack....
Read more >
How should I package my Language Server with my client?
What I want to do is to package both into a VSIX file, so I can install them together. In their example, they...
Read more >
Introducing the Markdown Language Server
The Markdown Language Server effort is split between two new (and similarly named!) open source libraries: Markdown Language Service - A ...
Read more >
How To Use Node.js Modules with npm and package.json
Introduction. Because of such features as its speedy Input/Output (I/O) performance and its basis in the well-known JavaScript language, Node ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found