Skip to content

Commit

Permalink
Improve typescript_tsdk lookup
Browse files Browse the repository at this point in the history
Fix microsoft#538

This plugin is unusable without this change when dealing with Yarn PnP projects.
  • Loading branch information
alecmev committed May 26, 2020
1 parent f21aba5 commit baec6b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion typescript/libs/editor_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ def initialize(self):

# retrieve the path to tsserver.js
# first see if user set the path to the file
settings = sublime.load_settings("Preferences.sublime-settings")
settings = sublime.active_window().active_view().settings()
tsdk_location = settings.get("typescript_tsdk")
if tsdk_location:
if not os.path.isabs(tsdk_location):
folders = sublime.active_window().folders()
if len(folders) == 0:
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")

tsdk_location = os.path.join(folders[0], tsdk_location)

proc_file = os.path.join(tsdk_location, "tsserver.js")
global_vars._tsc_path = os.path.join(tsdk_location, "tsc.js")
else:
Expand Down

0 comments on commit baec6b9

Please sign in to comment.