Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-eslint-language-server does not work #3520

Closed
wparsonsheins-globality opened this issue Aug 23, 2022 · 7 comments
Closed

vscode-eslint-language-server does not work #3520

wparsonsheins-globality opened this issue Aug 23, 2022 · 7 comments
Labels
C-bug Category: This is a bug

Comments

@wparsonsheins-globality

Summary

The eslint language server expects to be passed a workingDirectory but null was given.

Reproduction Steps

I tried this:

  1. hx
  2. Open a tsx file

I expected this to happen:
The language server could spawn

Instead, this happened:
The language server did not spawn

Helix log

~/.cache/helix/helix.log
2022-08-23T16:49:42.652 helix_lsp::transport [ERROR] err <- "(node:12369) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'workingDirectory' of null\n"

Platform

macOS

Terminal Emulator

Iterm2-3.4.16

Helix Version

helix 22.05

@wparsonsheins-globality wparsonsheins-globality added the C-bug Category: This is a bug label Aug 23, 2022
@the-mikedavis
Copy link
Member

workingDirectory is not part of the LSP spec - this server is expecting it as a configuration option. You can provide configuration options with the config option in languages.toml like here

@wparsonsheins-globality
Copy link
Author

I tried adding the config property but the logs show workingDirectory is still null.

[[language]]
name = "tsx"
scope = "source.tsx"
injection-regex = "^(tsx)$" # |typescript
file-types = ["tsx"]
roots = []
language-server = { command = "vscode-eslint-language-server", args = ["--stdio"], language-id = "typescriptreact" }
indent = { tab-width = 4, unit = "  " }
config = { "workingDirectory" = "./" }

@Ganitzsh
Copy link

Experiencing the same issue, I have been digging within the vscode-eslint-language-server code and logged some stuff, it seems that no configuration is found for the workspace despite setting the config property in the TOML file.

@LEI
Copy link
Contributor

LEI commented Feb 22, 2023

Here is a minimal working configuration based on lspconfig but it requires a fix present in #2507:

[language-server.eslint]
command = "vscode-eslint-language-server"
args = ["--stdio"]

[language-server.eslint.config]
validate = "on"
experimental = { useFlatConfig = false }
rulesCustomizations = []
run = "onType"
problems = { shortenToSingleLine = false }
nodePath = ""

With these settings the eslint language server runs when opening a file without errors.
Additional options like codeAction can be enabled.

@JeviScript
Copy link

JeviScript commented Nov 6, 2023

It seems that there is an additional problem. It seems that vscode-eslint-language-server does not work well for monorepos on it's own. When you have eslintConfig setup in root's package.json, launching eslint in sub-package won't find the root's config. Since vscode-eslint-language-server stops looking for workspace directory as soon it finds any of project's folder indicators such as "package.json". "eslintignore" or "eslintrc". It can be seen in the source code here: https://github.com/microsoft/vscode-eslint/blob/cbb35d03497bb39043033defbad7fd80b2a89698/server/src/eslintServer.ts#L1093

Vscode and vim tend to work cos they provide some hacky work arounds to find workspace directory. In helix, without plugin management, I am not sure what can be done (apart of manually setting workingDirectory path to workspace's directory

@th7mo
Copy link

th7mo commented Jan 22, 2024

@JeviScript I am working in a monorepo as well and having the same issue. Did you find a better solution to this problem in the meantime?

@JeviScript
Copy link

@JeviScript I am working in a monorepo as well and having the same issue. Did you find a better solution to this problem in the meantime?

I switched to vim xD

@helix-editor helix-editor locked and limited conversation to collaborators Apr 6, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10171 Apr 6, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

6 participants