microsoft / microsoft/TypeScript-Sublime-Plugin

Yarn 2 compatibility/incompatibility?

Open
#772 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
236
Avg merge
21d 13h
Merged PRs (30d)
1

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown Sublime project settings and the global typescript_tsdk setting, then inspect the Sublime console output for tsserver.js path resolution. Done means project-level Yarn 2 settings are recognized, the path no longer gains the Sublime Text installation prefix, and imported modules resolve.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.