Skip to content

Refactor Workspace - #198

Merged
randy3k merged 16 commits into
masterfrom
workspace
Feb 9, 2020
Merged

randy3k merged 16 commits into
masterfrom
workspace

Conversation

@randy3k

@randy3k randy3k commented Feb 8, 2020 •

Copy link
Copy Markdown
Member

documents are now moved inside workspace so that they can be easily removed from the workspace.

close #147

Comment thread R/completion.R Outdated
))
})
nonfuncts <- ns$nonfuncts[startsWith(ns$nonfuncts, token)]
nonfuncts <- ns$get_completions(funct_only = FALSE, exported_only = FALSE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funct_only = FALSE sounds like not only functs but also nonfuncts. Does funct = FALSE have clearer meaning?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right

Comment thread R/namespace.R Outdated
}
}
}
completions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another change is that we now generate completions on completion request rather than in the parse callback.

@randy3k randy3k Feb 8, 2020 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this, we need to decide how we should delete the document in textDocument/didClose for package projects and non-package projects.

Comment thread R/namespace.R Outdated

get_documentation = function(topic) {
pkgname <- self$package_name
item <- paste0(c(pkgname, topic), collapse = "::")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here documentation is stored per PackageNamespace rather than previously global documentation, it seems that we no longer have to use item as key, topic itself is good.

Comment thread R/namespace.R Outdated
}
},

get_completions = function(want_functs = TRUE, exported_only = TRUE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just feel redundant about want_functs since any parameter in any function should mean want something? If you feel okay, never mind :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is because in the code base functs is a vector of the function names and I don’t want to mix them up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your reminder!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question: I'm a bit confused by the name get_completions because completions means a list of CompletionItems in other contexts. It only returns a character of symbols or names. Does get_symbols have a clearer meaning?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

* renkun-ken/handle-untitled-document:
  Fix handling untitled document

* respect textDocument$text first

# Conflicts:
#	R/handlers-textsync.R
@randy3k

randy3k commented Feb 9, 2020

Copy link
Copy Markdown
Member Author

@renkun-ken Any other comments before we merge it?

Comment thread R/handlers-textsync.R
text_document_did_save <- function(self, params) {
textDocument <- params$textDocument
uri <- textDocument$uri
version <- textDocument$version

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we drop the document version on didSave?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DidSaveTextDocumentParams does not contain version.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just notice that DidOpenTextDocumentParams uses TextDocumentItem where version is defined and DidChangeTextDocumentParams uses VersionedTextDocumentIdentifier where version is defined.

@renkun-ken

Copy link
Copy Markdown
Member

LGTM

@randy3k

randy3k commented Feb 9, 2020

Copy link
Copy Markdown
Member Author

Let's merge it first. My next task is to improve test coverage #195.

@randy3k
randy3k merged commit be0f563 into master Feb 9, 2020
@randy3k
randy3k deleted the workspace branch February 9, 2020 04:03
@renkun-ken

renkun-ken commented Feb 9, 2020 •

Copy link
Copy Markdown
Member

Sorry, it seems we forget to refactor color provider.

Let me do a quick fix.

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.

Remove document from workspace on didClose for non-package

2 participants