microsoft / microsoft/TypeScript-Sublime-Plugin

Yarn 2 compatibility/incompatibility?

Aperta
#772 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
1.7k
Fork
236
Merge medio
21g 13h
PR unite (30g)
1

Descrizione

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!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con le impostazioni del progetto Sublime mostrate e l'impostazione globale typescript_tsdk, quindi controlla l'output della console di Sublime per la risoluzione del percorso di tsserver.js. Il lavoro è completato quando le impostazioni di Yarn 2 a livello di progetto vengono riconosciute, il percorso non riceve più il prefisso di installazione di Sublime Text e i moduli importati vengono risolti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
devtools, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.