Provide completion for session symbols#165
Conversation
|
Comments below were original posted in REditorSupport/languageserver#75. @renkun-ken requested to also post them here which are more relavent to this PR. Neither current vscode-R release and @renkun-ken's cutting-edge version can do the completion for my use case. Here is a reproducible example. library(eplusr)
path_idf <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr")
idf <- read_idf(path_idf, use_idd("auto"))
#> IDD v8.8.0 has not been parsed before.
#> Try to locate `Energy+.idd` in EnergyPlus v8.8.0 installation folder 'C:/EnergyPlusV8-8-0'.
#> IDD file found: 'C:\EnergyPlusV8-8-0\Energy+.idd'.
#> Start parsing...
#> Parsing completed.
class(idf)
#> [1] "Idf" "R6"
names(idf)
#> [1] ".__enclos_env__" "clone" "print"
#> [4] "run" "save" "is_unsaved"
#> [7] "to_table" "string" "to_string"
#> [10] "is_valid" "validate" "replace_value"
#> [13] "search_value" "del_object" "ins_object"
#> [16] "set_object" "add_object" "dup_object"
#> [19] "paste" "update" "load"
#> [22] "insert" "rename" "del"
#> [25] "set" "add" "dup"
#> [28] "search_object" "object_in_class" "objects_in_relation"
#> [31] "object_relation" "objects_in_group" "objects_in_class"
#> [34] "objects" "object_unique" "object"
#> [37] "object_num" "is_valid_name" "is_valid_id"
#> [40] "object_name" "object_id" "definition"
#> [43] "is_valid_class" "is_valid_group" "class_name"
#> [46] "group_name" "path" "version"
#> [49] "initialize"Created on 2020-01-01 by the reprex package (v0.3.0) In vscode, when I type Please note that |
|
Would you mind check I tried with environemnts with active bindings but everything looks normal here. |
|
It's embarrassing but I noticed that I did not attach the R session. Because R session created from vscode did not respect my Sorry for the bother. |
|
@renkun-ken I can confirm that Thanks for your great work! Wish this feature can be implemented into the language server, because I mainly use Vim with the language server for my R work. Anyway, thanks to you and other contributors, vscode-R indeed becomes a rich-featured R IDE now. |
|
@hongyuanjia, Thanks for your testing. As we discussed at REditorSupport/languageserver#75, languageserver is designed to only perform static analysis, i.e., no active R session is assumed. Session-related features are editor-specific at the moment. Maintainers of R support in other editors could implement such features using similar methods (we use a file-based method in vscode) or come up with better methods, or similar with RStudio methods (socket-based method), but anyway it is editor-specific. |
|
@Ikuyadeu @andycraig This PR is a LGTM. Please take a look. |
6eb053d to
94c582d
Compare
|
This looks amazing and I will try to review it this weekend. |
andycraig
left a comment
There was a problem hiding this comment.
I have tested this on Windows and all the features work. I haven't reviewed the code carefully but I think it is fine to merge. It is a great addition!
What problem did you solve?
Closes #164
Closes #170
This PR provides
strin documentation. The latest languageserver already supports workspace completion (global variables in code), scope completion (local variables in scope). This PR adds session completion as a new kind of completion.[], mainly for subsetting and extracting using"col", or accessing elements with dynamic scoping in brackets (usage ofdata.table).(If you have)Screenshot
Session symbol completion
Completion for elements in list-like objects
Completion for brackets
Quoted symbol:
Element completion for dynamic scoping in data.table: