Skip to content

language server should be able to fufill requests even without textdocument/didOpen Notifications #15

Open

Description

@ggilmore

The LSP Spec says the following:

... Note that a server’s ability to fulfill requests is independent of whether a text document is open or closed.

For example, I see no hover when I hover over length in this file: https://github.com/gluc/data.tree/blob/HEAD/R/node_methods_traversal.R#L93, unless I manually send this didOpen notification with the file contents. The spec says that language servers should still be able to hovers, etc. even without this notification.

Activity

  1. randy3k commented on Apr 26, 2018

    @randy3k
    Member

    It can be considered as a bug. The hover reply is not sent back because the server fails to load the document content. The document content is only loaded when upon didOpen, didChange and didSave.

  2. andycraig commented on Oct 3, 2019

    @andycraig
    Contributor

    Can we add a feature to automatically load all R files in the workspace on initialisation (and on workspace change)?

    I think the throttling already implemented in process_sync_in would avoid overwhelming the computer even in workspaces with many R files.

    I am happy to work on this.

  3. randy3k commented on Oct 3, 2019

    @randy3k
    Member

    When you say all R files, what are those R files? We are already loading the R files if the root folder is a R package.

  4. andycraig commented on Oct 3, 2019

    @andycraig
    Contributor

    The case where the root folder (and possibly subfolders) contain R files, but the root directory not itself a package.

    For example, in this structure I would like all of a.R, b.R and c.R to be loaded on startup:

    root/
    - a.R
    - b.R
    - package1/
      - R/
        - c.R
    
  5. renkun-ken commented on Oct 4, 2019

    @renkun-ken
    Member

    In my case, each of my research projects often contain 500+ R scripts, 70k+ lines of code, which is almost surely a disaster if all files are loaded on startup.

    For me, a way to provide language service that makes more sense is to provide LS to a file and referenced files (#20). And completion should be independently provided for eah file for its content (#58). Or otherwise, as the project grows, the burden of LSP gets heavier; or as I open more and more files, LSP provides more and more info mixed with every file I opened.

  6. andycraig commented on Oct 4, 2019

    @andycraig
    Contributor

    Okay, at present it sounds like keeping the current system (automatically loading files only if the root folder is a package) is better than loading all files within the workspace.

  7. renkun-ken commented on Oct 6, 2026

    @renkun-ken
    Member

    #751 has merged and now indexes closed R files throughout projects, including workspace-symbol summaries and full parsing of package R files and static source() dependencies.

    This only partially addresses the request: arbitrary hover and other document requests do not universally load an unrelated closed script on demand before didOpen. Shallow workspace indexing is not a substitute for that behavior, so this stays open.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions