Hi, I get the sense that there are pressures from different directions for Atom-based markdown LSP clients, but this one was my starting point. Based on a few discussions from search, it looks like packages moving to ESM means that many are already broken in Atom.
For the record, here are some steps that others might find informative:
$ atom --version
Atom : 1.58.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1
$ echo $ATOM_HOME
/tmp/atom-temp
$ ls -1
shell.nix
we are working with a bare atom setup from a bare directory; shell.nix declares atom and python 3.10 and python-lsp-server. Python is for verification.
$ apm install atom-ide-base atom-ide-ui ide-python # install lsp-related packages (I think so)
$ atom --dev --portable . # start atom
In Atom, open the command palette (ctrl-shift-P) and run window:reload. Open a random python file and confirm that LSP integration works. I believe it works because syntax errors get marked in the source file, and the process list shows that atom has spawned a python pylsp process.
Now go back to Install Packages and Themes / apm, and install linter-remark. run window:reload. Open a random markdown file. Following the demo in the readme, I create a file with
This doesn't [exist](#heading)...
The editor doesn't indicate anything wrong, and there is no interesting process under atom's process tree.
Open the dev tools console (ctrl-shift-I). There is an interesting error
Uncaught (in promise) Error: Dependency#0 for linter-remark is invalid
at invariant (/tmp/atom-temp/packa…ps/lib/index.js:553)
at /tmp/atom-temp/packa…ps/lib/index.js:571
at Array.forEach (<anonymous>)
at getDependencies$2 (/tmp/atom-temp/packa…ps/lib/index.js:561)
at Object.install (/tmp/atom-temp/packa…ps/lib/index.js:912)
Now, I believe this is the ESM-related error.
Based on #15, there seems to be at least one Just Works scenario (https://github.com/wooorm/linter-remark/pull/15#issuecomment-1003721097) but I am not sure how to navigate linter-remark's code yet, so I try something simpler, which also matches an approach of "bring your own node" I see in some other related threads.
change main.js getGrammarScopes to return ['text.md', 'Markdown']; note that the "Grammar" is actually provided by the package language-markdown. This seems to be undocumented. Without the grammar, text.md is not matched for a markdown file.
in addition, I confirmed that running node path/to/remark-language-server/index.js --stdio spawns a server process, though I don't know how to communicate with it without a client, and I haven't yet gone down the more often seen "make a VSCode client" rabbithole.
change package.json
"enhancedScopes": [
"text.md",
"Markdown"
],
relaunch atom and open a markdown file. At this point, we get some new errors
Uncaught (in promise) Error [ERR_STREAM_DESTROYED] [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:431)
at writeOrBuffer (_stream_writable.js:419)
at Socket.Writable.write (_stream_writable.js:309)
at …/lib/node/ril.js:90
at new Promise (<anonymous>)
at WritableStreamWrapper.write (…/lib/node/ril.js:80)
at StreamMessageWriter.doWrite (…essageWriter.js:100)
at …messageWriter.js:91
the client/registerCapability warning is quite interesting, but since the error appears before it, maybe it's a red herring.
At this point I can use some help from more experienced folks. My goal is to get an LSP client for markdown working in Atom. I'm not tied to a server or client implementation, although remark-language-server and linter-remark appear to be the most recent active projects so far.
Hi, I get the sense that there are pressures from different directions for Atom-based markdown LSP clients, but this one was my starting point. Based on a few discussions from search, it looks like packages moving to ESM means that many are already broken in Atom.
I am trying to piece together a path to a minimum working setup based on this repo, https://github.com/wooorm/linter-remark/pull/15, https://github.com/remarkjs/remark-language-server/pull/4, and others, but haven't gotten anything to work with markdown yet.
For the record, here are some steps that others might find informative:
we are working with a bare atom setup from a bare directory;
shell.nix
declares atom and python 3.10 and python-lsp-server. Python is for verification.In Atom, open the command palette (ctrl-shift-P) and run
window:reload
. Open a random python file and confirm that LSP integration works. I believe it works because syntax errors get marked in the source file, and the process list shows that atom has spawned a pythonpylsp
process.Now go back to Install Packages and Themes / apm, and install
linter-remark
. runwindow:reload
. Open a random markdown file. Following the demo in the readme, I create a file withThe editor doesn't indicate anything wrong, and there is no interesting process under atom's process tree.
Open the dev tools console (ctrl-shift-I). There is an interesting error
Now, I believe this is the ESM-related error.
Based on #15, there seems to be at least one Just Works scenario (https://github.com/wooorm/linter-remark/pull/15#issuecomment-1003721097) but I am not sure how to navigate
linter-remark
's code yet, so I try something simpler, which also matches an approach of "bring your own node" I see in some other related threads.use ide-json as a starting point:
confirm that botching a json file leads to syntax errors in the edit window = lsp is working.
https://github.com/atom/ide-json/blob/master/lib/main.js tells us that at minimum, we need to spawn the LSP server process. So I modify ide-json to use
remark-language-server
:getGrammarScopes
toreturn ['text.md', 'Markdown']
; note that the "Grammar" is actually provided by the packagelanguage-markdown
. This seems to be undocumented. Without the grammar,text.md
is not matched for a markdown file.in addition, I confirmed that running
node path/to/remark-language-server/index.js --stdio
spawns a server process, though I don't know how to communicate with it without a client, and I haven't yet gone down the more often seen "make a VSCode client" rabbithole.and some warnings
the
client/registerCapability
warning is quite interesting, but since the error appears before it, maybe it's a red herring.At this point I can use some help from more experienced folks. My goal is to get an LSP client for markdown working in Atom. I'm not tied to a server or client implementation, although
remark-language-server
andlinter-remark
appear to be the most recent active projects so far.Thank you for your time and effort!