Skip to content

Commit baec6b9

Browse files
authored
Improve typescript_tsdk lookup
Fix #538 This plugin is unusable without this change when dealing with Yarn PnP projects.
1 parent f21aba5 commit baec6b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

typescript/libs/editor_client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ def initialize(self):
5151

5252
# retrieve the path to tsserver.js
5353
# first see if user set the path to the file
54-
settings = sublime.load_settings("Preferences.sublime-settings")
54+
settings = sublime.active_window().active_view().settings()
5555
tsdk_location = settings.get("typescript_tsdk")
5656
if tsdk_location:
57+
if not os.path.isabs(tsdk_location):
58+
folders = sublime.active_window().folders()
59+
if len(folders) == 0:
60+
raise ValueError("typescript_tsdk is set to a relative path \"" + tsdk_location + "\", but there are no folders open in the active window, so we don't know where to look for it")
61+
62+
tsdk_location = os.path.join(folders[0], tsdk_location)
63+
5764
proc_file = os.path.join(tsdk_location, "tsserver.js")
5865
global_vars._tsc_path = os.path.join(tsdk_location, "tsc.js")
5966
else:

0 commit comments

Comments
 (0)