fix: Cannot open file in Sublime Text

Open Beginner friendly
#964 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
node.js, nuxtjs, typescript

Research direction

Start at packages/devtools/src/server-rpc/general.ts around line 227 and trace how the configured Sublime Text editor is passed to launch-editor. Reproduce on Linux with subl on PATH, then verify that opening a file launches Sublime Text instead of attempting the nonexistent sublime command.

Written by the indexing model from the issue text.

Description

bug
🐛 The bug

I selected Sublime Text as my editor in the Nuxt devtools setting, but the file is not opened. Reading the exception on the console, this makes sense because apparently it tries to launch an executable named sublime, which does not exist. The expected executable name on Linux platform is subl, which is also configured as such in launch-editor.

The error:

The editor process exited with an error: spawn sublime ENOENT ('sublime' command does not exist in 'PATH').

Now, I do not know if this is an issue in launch-editor, but seeing how manually overriding the LAUNCH_EDITOR environment variable neither in the command that calls npm, nor in the .env file makes any difference, I suspect that the Nuxt devtools might be using this library incorrectly. I tried subl and sublime_text as values.

The library is invoked here:

https://github.com/nuxt/devtools/blob/836ee1c5702f6eb527e3d20359e28bd65970f93a/packages/devtools/src/server-rpc/general.ts#L227

🛠️ To reproduce
  1. Ensure Sublime Text is installed (or create a fake subl executable on a Linux system)
  2. Configure "Sublime Text" to be the editor in devtools.
  3. Try to open an file in your editor.
🌈 Expected behavior

The file is opened in my local Sublime Text editor.

ℹ️ Additional context

I am using Arch Linux and installed Sublime Text using the official repository. subl is available on my $PATH and works in the terminal.

Dominant language
TypeScript
Stars
3.3k
Forks
214
Avg merge
19h 45m
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

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.

More from nuxt/devtools

All issues in nuxt/devtools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.