Skip to content

No language features in a document opened from workspace/textDocumentContent #2026

Closed

Description

@lagergren

LSP4IJ 0.30.0 opens a document that a language server provides with workspace/textDocumentContent (#1749) as a read-only DocumentContentFile and connects it to the server: the server gets didOpen and pulls its diagnostics. No other feature works in it, though: Go to Definition, hover, highlighting, folding, semantic tokens, inlay hints and code lenses send no request.

LanguageServersRegistry.isFileSupported returns false for a LightVirtualFile outside the local file system (since #782), and a DocumentContentFile is a LightVirtualFile. LSPGotoDeclarationHandler and the other features check isFileSupported before they ask the server, so they return nothing.

Once the check passes for a DocumentContentFile, hover fails: MarkdownConverter.getHtmlRenderer takes the parent of the file as the base directory of relative links, and a DocumentContentFile has no parent:

java.lang.NullPointerException: Cannot invoke "com.intellij.openapi.vfs.VirtualFile.getFileSystem()" because the return value of "com.intellij.openapi.vfs.VirtualFile.getParent()" is null
	at com.redhat.devtools.lsp4ij.features.documentation.MarkdownConverter.getHtmlRenderer(MarkdownConverter.java:132)

To reproduce

The language server of xtclang/xvm serves the sources of its bundled libraries as ecstasy-library: documents. Go to Definition on a library type opens its source; Go to Definition on a call in that source then does nothing in IntelliJ, though the server answers textDocument/definition for it when asked directly.

In LSP4IJ's own tests: in DocumentContentNavigationTest, open the server's document in an editor and call new LSPGotoDeclarationHandler().getGotoDeclarationTargets(element, offset, editor) in it. It returns no target, and the mock server gets no textDocument/definition.

Activity

  1. added this to the 0.30.2 milestone on Nov 20, 2026
  2. added a commit that references this issue on Nov 21, 2026
    9cf7de5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions