REditorSupport / languageserver

An implementation of the Language Server Protocol for R
Other
586 stars 94 forks source link

Provide completion for list-like objects in package #158

Open renkun-ken opened 4 years ago

renkun-ken commented 4 years ago

We may provide completion for list-like objects in package such as .Machine, .Platform, and objects defined in packages such as R6 classes since their elements are known.

In contrast with https://github.com/Ikuyadeu/vscode-R/pull/165 which provides completion for elements in list-like objects in a live R session, languageserver may do similar for list-like objects in packages.

qinwf commented 4 years ago

With typescript style type definition file will help simplify the work, aka typedef for R object.

R6 classes are already typed. They will be easier to process.

renkun-ken commented 4 years ago

Sounds interesting, would you like to elaborate?

qinwf commented 4 years ago

https://devblogs.microsoft.com/python/announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code/

Python introduced https://docs.python.org/3/library/typing.html

and pylance is using https://github.com/microsoft/pyright for the information, which is similar to typescript and javascript.

renkun-ken commented 4 years ago

@qinwf Just noticed Pylance yesterday. Looks quite promising. Do you have any idea how we could benefit from its design or implementation?

qinwf commented 4 years ago

Pylance is based on type hints feature built into Python 3.5+.

There is no typing library for R now. A gradual type system is required to enable features like it.

To build a gradual type system, there will be a frontend to do type checking for R code without running the code.