languageserver icon indicating copy to clipboard operation
languageserver copied to clipboard

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

Open ggilmore opened this issue 7 years ago • 6 comments

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.

ggilmore avatar Apr 26 '18 22:04 ggilmore

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.

randy3k avatar Apr 26 '18 22:04 randy3k

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.

andycraig avatar Oct 03 '19 23:10 andycraig

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.

randy3k avatar Oct 03 '19 23:10 randy3k

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

andycraig avatar Oct 03 '19 23:10 andycraig

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.

renkun-ken avatar Oct 04 '19 00:10 renkun-ken

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.

andycraig avatar Oct 04 '19 09:10 andycraig