Skip to content

Start the Markdown and Astro language servers in the decoded project path - #2278

Open
RoiSoleil wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
RoiSoleil:fix-working-directory-encoded-path
Open

RoiSoleil wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
RoiSoleil:fix-working-directory-encoded-path

Conversation

@RoiSoleil

Copy link
Copy Markdown

Fixes #2277.

MarkdownLanguageServer and AstroLanguageServer set the working directory of the server process with projectRootUri.getRawPath(), which keeps the percent-encoding of the URI (%C3%A9 for é, %20 for a space). In a project whose path contains such a character the directory does not exist and the process cannot start (CreateProcess error=267 on Windows, Cannot run program ... (in directory ".../%C3%89v%C3%A9nements ...") on Linux).

The change: the working directory is now Paths.get(projectRootUri).toString(), the decoded file system path. For a URI that is not a file: URI, the working directory set in the constructor (user.dir) is kept, since Paths.get cannot convert it (before, its raw path was used, which is not a local directory either). AstroLanguageServer also gets the null check that MarkdownLanguageServer already had.

Test: TestMarkdown.languageServerStartsInProjectWithAccentAndSpaceInPath opens a Markdown file of a project named Événements <n> and waits for the Markdown language server. It fails without the change (the server does not start, with the error above in the workspace log) and passes with it. TestMarkdown (13 tests) and TestAstro pass; no new compiler warning.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GviovNL1A9qQNNC72f312S

…path

The working directory was set with URI.getRawPath(), which keeps the
percent-encoding (%C3%A9 for an accented letter, %20 for a space), so
the language server could not start in a project whose path contains
one: "CreateProcess error=267" on Windows. Paths.get(URI) gives the
actual file system path.

Fixes eclipse-wildwebdeveloper#2277

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GviovNL1A9qQNNC72f312S
Signed-off-by: Hélios GILLES <[email protected]>
@RoiSoleil

Copy link
Copy Markdown
Author

@sebthom could you review this one when you have time? As the author of the Markdown and Astro language server integrations, you know this code best. It is a small fix: the working directory came from URI.getRawPath(), so in a project whose path has an accent or a space the server was started in a percent-encoded directory that does not exist and failed to start. The new TestMarkdown test fails without the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown and Astro language servers do not start when the project path contains a non-ASCII character or a space

1 participant