Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn 2 compatibility/incompatibility? #772

Open
tmillr opened this issue Apr 19, 2021 · 2 comments
Open

Yarn 2 compatibility/incompatibility? #772

tmillr opened this issue Apr 19, 2021 · 2 comments

Comments

@tmillr
Copy link

tmillr commented Apr 19, 2021

I'm trying to use this plugin with sublime and yarn 2, but ts "cannot find" imported modules (installed with yarn add for example).

Here are my sublime project settings:

{
	"folders": [
		{
			"path": "."
		}
	],

	"settings": {
		"typescript_tsdk": "${project_path}/.yarn/sdks/typescript/lib",

		"SublimeLinter.linters.eslint.executable": "${project_path}/.yarn/sdks/eslint/bin/eslint.js",
		"SublimeLinter.linters.eslint.selector": "source.ts, source.js - meta.attribute-with-value"
	}
}

I got eslint working perfectly with yarn 2, but not this plugin. This config here doesn't even seem to get picked up by the plugin for some reason? I know I'm probably missing something that needs to be done in order to specify the setting at the project level, but the docs for this plugin do not elaborate on the specifications of configuring via project settings.

When I specify typescript_tsdk in my main sublime settings however, then the setting does seem to get picked up (I know this because checking in the console reveals an error from this plugin). The setting gets picked up but it errors with

Error: Cannot find module '/Applications/Sublime Text.app/Contents/MacOS/${project_path}/.yarn/sdks/typescript/lib/tsserver.js'

for some reason it is appending my configured path to /Applications/Sublime Text.app/Contents/MacOS/???

I tried both using the project_path var, and also just a ./ prefix, and both produce the same error and do the same thing (append the path to /Applications/Sublime Text.app/Contents/MacOS/ on load). I'm deferring to the global config (instead of project settings like I originally intended) in order to try to just get it setup temporarily so I could do some work already, but I can't get that working either. Obviously it would be optimal to have it configured at the project level since not every project will use yarn 2/yarn cache though. Any help would be great! Thank you!

@Jengamon
Copy link

LSP-typescript seems to support setting typescript.tsdk by this example config:

{
	"folders":
	[
		{
			"path": "."
		}
	],
	"settings": {
		"LSP": {
			"LSP-typescript": {
				"settings": {
					"typescript.tsdk": "${project_dir}/.yarn/sdks/typescript/lib/",
				}
			}
		}
	}
}

I don't know how to get this plugin to stop outputting errors...

@Jengamon
Copy link

I spoke too soon. It stopped outputting any errors, which is very very wrong...

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

No branches or pull requests

2 participants