sublimelsp / LSP-volar

Vue support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yarn 3 no node_modules support

Jengamon opened this issue · comments

I've dug around so much, but I haven't been able to get this tool to run with a custom, per-project tsserverlibrary, as that's how my set up with Yarn 3 works: there is no node_modules to rely on. Are there any plans for Yarn 3 support?

For LSP-typescript, I simply point "server_path" at a different "tsserver.js" and done.

Maybe this?

"typescript": {
// "serverPath": "/path/to/tsserverlibrary.js"
},

Tried it, didn't work.

Can you provide the output of LSP: Troubleshoot Server on a vue file?

Troubleshooting: LSP-volar

Version

  • LSP: 1.14.0
  • Sublime Text: 4121

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "${node_bin}", 
  "${server_path}", 
  "--stdio"
]
  • shell command
E:\nodejs\node.EXE "C:\Users\USER_NAME\AppData\Local\Sublime Text\Package Storage\LSP-volar\16.13.0\server\node_modules\@volar\server\out\index.js" --stdio
  • selector
(text.html.vue)
  • priority_selector
(text.html.vue)
  • init_options
{
  "documentFeatures": {
    "documentColor": true, 
    "documentFormatting": {
      "defaultPrintWidth": 90
    }, 
    "documentSymbol": true, 
    "foldingRange": true, 
    "linkedEditingRange": false, 
    "selectionRange": true
  }, 
  "languageFeatures": {
    "callHierarchy": false, 
    "codeAction": true, 
    "codeLens": false, 
    "completion": {
      "defaultAttrNameCase": "kebab", 
      "defaultTagNameCase": "both", 
      "getDocumentNameCasesRequest": false, 
      "getDocumentSelectionRequest": false
    }, 
    "definition": true, 
    "diagnostics": true, 
    "documentHighlight": true, 
    "documentLink": false, 
    "hover": true, 
    "references": true, 
    "rename": true, 
    "renameFileRefactoring": false, 
    "schemaRequestService": false, 
    "semanticTokens": false, 
    "signatureHelp": true, 
    "typeDefinition": true
  }, 
  "typescript": {}
}
  • settings
{
  "volar": {
    "codeLens": {
      "pugTools": false, 
      "references": true, 
      "scriptSetupTools": false
    }, 
    "completion": {
      "autoImportComponent": true
    }, 
    "preferredAttrNameCase": "auto-kebab", 
    "preferredTagNameCase": "auto"
  }
}
  • env
{
  "PATH": "E:\\nodejs;E:\\nodejs;"
}

Active view

  • File name
E:\NodeProjects\comp_coop\comp_coop.sublime-project
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": null, 
  "syntax": "Packages/JSON/JSON.sublime-syntax"
}
  • base scope
source.json

Project / Workspace

  • folders
[
  "E:\\NodeProjects\\comp_coop"
]
  • is project: True
  • project data:
{
  "folders": [
    {
      "path": "."
    }
  ], 
  "settings": {
    "server_path": "${typescript_tsdk}/tsserver.js"
  }
}

LSP configuration

System PATH

  • E:\Python310\Scripts\
  • E:\Python310\
  • C:\Python310\Scripts\
  • C:\Python310\
  • F:\VulkanSDK\1.2.189.2\Bin
  • C:\Program Files (x86)\Common Files\Oracle\Java\javapath
  • D:\Python39\Scripts\
  • D:\Python39\
  • C:\Windows\system32
  • C:\Windows
  • C:\Windows\System32\Wbem
  • C:\Windows\System32\WindowsPowerShell\v1.0\
  • C:\Windows\System32\OpenSSH\
  • C:\Program Files\Sublime Merge
  • C:\Program Files\Sublime Text
  • D:\CMake\bin
  • D:\LLVM\bin
  • C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
  • C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
  • E:\Airshipper\
  • E:\Graphviz\bin
  • E:\Go\bin
  • C:\Program Files\dotnet\
  • E:\nodejs\
  • C:\ProgramData\chocolatey\bin
  • E:\Git\cmd
  • E:\LOVE
  • E:\Lua\5.1
  • E:\Lua\5.1\clibs
  • C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
  • E:\Elm\0.19.1\bin
  • C:\Users\USER_NAME.cargo\bin
  • C:\Users\USER_NAME\AppData\Local\Microsoft\WindowsApps
  • c:\users\USER_NAME.local\bin
  • D:\Microsoft VS Code\bin
  • C:\ProgramData\USER_NAME\GitHubDesktop\bin
  • C:\Users\USER_NAME\go\bin
  • C:\Users\USER_NAME\AppData\Roaming\npm
  • C:\Users\USER_NAME.deno\bin
  • E:\Julia-1.6.4\bin

That's not a proper structure for the project settings. Should be:

{
  "folders": [
    {
      "path": "."
    }
  ],
  "LSP": {
    "LSP-volar": {
      "initializationOptions": {
        "typescript.serverPath": "${typescript_tsdk}/tsserverlibrary.js"
      }
    }
  }
}

With ${typescript_tsdk} replaced with proper path since there is nothing that will resolve such variable.

I'll try what you said, but it is proper, because it's that's not for LSP-volar, but for LSP-typescript, and typescript_tsdk is defined in my user config, does LSP-volar not do substitutions?

And is it not supposed to go under "settings"?

server_path has nothing to do with LSP-typescript either.

I'm not sure what it's for. I thought for a second you might be using https://packagecontrol.io/packages/TypeScript instead but that one doesn't reference such name anywhere either.

And is it not supposed to go under "settings"?

You are right. So like this:

{
  "folders": [
    {
      "path": "."
    }
  ],
  "settings": {
    "LSP": {
      "LSP-volar": {
        "initializationOptions": {
          "typescript.serverPath": "/path/to/tsserverlibrary.js"
        }
      }
    }
  }
}

In any case, I wanted to see what have you tried to make LSP-volar work but the troubleshooting output doesn't include any volar specific settings so I can't tell what you have done wrong. Please try with my suggestion first.

From LSP-typescript.sublime-settings

{
	"command": ["${node_bin}", "${server_path}", "--stdio"],

and putting the full path worked!

thanks!

Wait, I restarted sublime and it stopped. I did use ${project_path} and ${project_dir} to no avail.

You can't just use those variables anywhere. Those are only expanded in specific places and packages. What have you done exactly?

"settings": {
		"server_path": "${typescript_tsdk}/tsserver.js",
		"LSP": {
		    "LSP-volar": {
		      	"initializationOptions": {
		        	"typescript.serverPath": "${project_dir}/.yarn/sdks/typescript/lib/tsserverlibrary.js"
		      	},
		      	"selector": "text.html.vue | source.ts | source.tsx | source.js | source.jsx"
		    },
		    "LSP-typescript": {
		    	"enabled": false
		    }
		},	
	}

Ok, it works with ${project_path}. Thanks!

We can add the logic to find the ts server in .yarn/sdks,
so you do not have to add project settings.

Created a new release:
https://github.com/sublimelsp/LSP-volar/releases/tag/1.0.15

Now, there is no need to manually specify this:

		    "LSP-volar": {
-		      	"initializationOptions": {
-		        	"typescript.serverPath": "${project_dir}/.yarn/sdks/typescript/lib/tsserverlibrary.js"
-		      	},
		      	//...
		    },

LSP-volar can automatically find and use the typescript from the .yarn/sdks folder.