Skip to content

Conversation

@martinjlowm
Copy link
Contributor

This PR adds SDK documentation for Emacs which utilizes the generated binary wrappers for VS Code and supplies a new wrapper for https://github.com/theia-ide/typescript-language-server, enabling LSP support within Emacs.

Additionally, this also sorts SDK wrappers by name.

)))))
```

4. You may have to install `vscode-jsonrpc` and `vscode-languageserver-protocol` manually if `typescript-language-server` fails to start (they are not listed in its dependencies as of this writing):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add those dependencies to the builtin packageExtensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly! I'm pretty sure the experience becomes less confusing.

…ver wrapper for (Emacs') LSP support

This also sorts SDK wrappers by name.
@martinjlowm martinjlowm force-pushed the docs/sdk-emacs branch 2 times, most recently from 11f6e5f to 4866b1d Compare March 29, 2020 17:37
@arcanis arcanis merged commit a541fbb into yarnpkg:master Apr 1, 2020
@arcanis
Copy link
Member

arcanis commented Apr 1, 2020

Perfect, thanks @martinjlowm !

@gamb
Copy link

gamb commented Aug 14, 2020

@martinjlowm As far as I can tell typescript-language-server doesn't seem to recognise PnP dependencies, is this a known issue? Perhaps one we could highlight in these docs. By comparison I find https://github.com/ananthakumaran/tide works a lot better with Yarn2+PnP.

@gamb
Copy link

gamb commented Aug 14, 2020

** That is, dependencies aren't recognised even if I yarn unplug them

@gamb
Copy link

gamb commented Aug 14, 2020

*lsp-log* shows the sdk language server is used:

The following clients were selected based on priority: (server-id ts-ls, priority -2)
Command "/Users/adamgamble/yarn-emacs-test/.yarn/sdks/typescript-language-server/lib/cli.js --tsserver-path /Users/adamgamble/yarn-emacs-test/.yarn/sdks/typescript/bin/tsserver --stdio" is present on the path.
Command "/Users/adamgamble/yarn-emacs-test/.yarn/sdks/typescript-language-server/lib/cli.js --tsserver-path /Users/adamgamble/yarn-emacs-test/.yarn/sdks/typescript/bin/tsserver --stdio" is present on the path.
Found the following clients for /Users/adamgamble/yarn-emacs-test/hooks/useApi.ts: (server-id ts-ls, priority -2)
The following clients were selected based on priority: (server-id ts-ls, priority -2)
Cancelling textDocument/codeAction(26) in hook post-command-hook

@martinjlowm
Copy link
Contributor Author

I migrated to LSP because I found Tide to be very slow :(. I don't know if that is still the case.

Your setup looks correct, however, to see implementation details you would have to unplug specific dependencies. It's obviously not ideal and it would require a mapping of find-file to an implementation that supports the PnP interface. Do you know how/if Tide handles this properly?

Type resolution itself should work out of the box, since it is the tsserver entry that resolves those and it's already wrapped for PnP.

@gamb
Copy link

gamb commented Aug 14, 2020

Yeah I'd rather LSP as it is faster but even with unplugged dependencies I can't seem to get LSP to find react… I've not got a good debug setup yet though, e.g. can't see LSP responses.

Tide is a little slow, although it is worth trying it with (setq tide-server-max-response-length 4284928) (or some big number) for larger projects - avoids some unnecessary timeouts due to response size.

Had some success using Tide to jump to definition inside zipped buffer… ananthakumaran/tide#388

@gamb
Copy link

gamb commented Aug 14, 2020

-    "typescript": "^3.8.3"
+    "typescript": "^3.8.3",
+    "typescript-language-server": "^0.4.0"
+  },
+  "dependenciesMeta": {
+    "react": {
+      "unplugged": true
+    },
+    "react-dom": {
+      "unplugged": true
+    }

Hmm LSP totally not picking up "react" still. Cannot find module 'react'. [2307] …And no type resolution :(

@martinjlowm
Copy link
Contributor Author

Sorry, I forgot about this - I have just returned from a 2 week vacation... have you had any luck getting this to work? It sounds to me as if LSP still uses an unpatched typescript "entry", which does support resolving virtual paths in zip archives.

/Users/adamgamble/yarn-emacs-test/.yarn/sdks/typescript/bin/tsserver --stdio

looks good to me though 🤔

Unplugging is only necessary if you want to follow definitions.

@delucca
Copy link

delucca commented Oct 26, 2020

@martinjlowm same issue here, check #2049

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants