Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all symbols in definitions #295

Merged
merged 6 commits into from
Jul 3, 2020

Conversation

renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Jul 2, 2020

This PR adds all symbols to definitions so that it is easier to search symbols via document/workspace symbol search.

func <- function(x, y) {
  m <- x + y
  n <- x * y
  m + n
}

# R6 class
Person <- R6::R6Class("Person",
  private = list(
    name = NULL,
    age = NULL
  ),
  public = list(
    initialize = function(name) {
      private$name <- name
    },
    greeting = function() {
      cat("Hello, my name is ", private$name, "!\n", sep = "")
    }
))

person <- Person$new(name = "Somebody")

num <- 1
lgl <- TRUE
text <- "hello"

vec <- c(1, 2, 3)

lst <- list(
  x = 1,
  y = 2,
  z = list(a = 1, b = 2)
)

var <- rnorm(100)

The above code has the following symbol outline:

image

Some function calls are specially treated to generate different kinds of document symbols. c(),matrix(), and array() creates Array symbol, list() creates Struct symbol, and R6Class() creates Class symbol. Code editor or extensions could work with these type-like symbols. In VSCode, for example, git integration could show the git history for Class and Struct symbols.

image

image

Also, non-function symbols in global namespace could also have documentation to show in completion.

image

A screencast:

Kapture 2020-07-07 at 23 22 08

@renkun-ken renkun-ken requested a review from randy3k July 2, 2020 06:16
@renkun-ken renkun-ken merged commit 556e31a into REditorSupport:master Jul 3, 2020
@renkun-ken renkun-ken mentioned this pull request Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants