Skip to content

vite-plus/lsp: config search behind env flag #21654

Description

@Sysix

Problem found in #21481, should fail on main too.

The oxfmt or oxlint LSP server only checks for vite.config.ts files, if the VP_VERSION is set.
This can create a problem, when we support files outside the current workspace.

Example

This example shows how the vite config will not be respected, when linting from a non vite project.

Setup

Project A: /home/project-a/

Has vite-plus installed and a vite.config.ts file in the root.

Project B: /home/project-b/

Uses oxfmt native without the VP_VERSION env.

Steps

  • Open project B in your editor, like code /home/project-b/
  • Drag a file from Project A into your editor
  • Format the dragged file

Problem

Because we started the server from /home/project-b/node_modules/.bin/oxfmt, we do not set the VP_VERSION environment for the language server.
The editor will format the file with default oxfmt settings and does not search the vite.config.ts file in /home/project-a/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-editorArea - Editor and Language ServerA-formatterArea - FormatterA-linterArea - Linter

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions