Skip to content

LSP extension matching broken for extensionless files (e.g. wscript, Makefile, Dockerfile) #33372

Description

@Erik-Vimotek

Bug

LSP servers configured with extensionless filenames in the extensions array never activate. This affects any extensionless file that should be treated as Python, such as wscript files used by the waf build system.

Root cause

The extension matching logic falls back to the full absolute path when a file has no extension:

let m = z1.parse(K).ext || K

For /home/user/project/subdir/wscript, path.parse(K).ext is "", so m becomes the full path. extensions.includes(m) then never matches "wscript".

Suggested fix

let m = z1.parse(K).ext || z1.basename(K)

Reproduction

"lsp": {
  "pyright": {
    "command": ["pyright-langserver", "--stdio"],
    "extensions": [".py", ".pyi", "wscript"]
  }
}

Open any file named wscript. The LSP server never starts.

Version

OpenCode 1.17.9

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions