Skip to content

Enhance workspace viewer#1022

Merged
renkun-ken merged 16 commits intoREditorSupport:masterfrom
renkun-ken:workspace-watcher
Mar 5, 2022
Merged

Enhance workspace viewer#1022
renkun-ken merged 16 commits intoREditorSupport:masterfrom
renkun-ken:workspace-watcher

Conversation

@renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Mar 3, 2022

What problem did you solve?

Closes #1018

This PR renames the global environment watcher to workspace watcher and includes search() and loadedNamespaces() in the writing of workspace.json instead of the previous globalenv.json. The following are improved:

  • The workspace viewer contains more information of the R workspace: attached namespaces, loaded namespaces, and global environment symbols.
  • The global environment symbols now get proper icons consistent with their completion item icons.
  • Clicking the package:foo items in Attached Namespaces or items in Loaded Namespaces will show quick pick of help topics of that package.

(If you have)Screenshot

Kapture.2022-03-04.at.20.58.33.mp4

(If you do not have screenshot) How can I check this pull request?

@renkun-ken
Copy link
Member Author

I'm trying to give those attached packages and loaded namespaces commands so that clicking them will trigger a quick pick of topics for that package. But it does not seem to be easily achievable with the existing help manager. @ManuelHentschel Any thoughts?

@renkun-ken renkun-ken requested a review from ElianHugh March 4, 2022 01:46
@ElianHugh
Copy link
Collaborator

Thanks for the PR, this is super cool :) I will have a look at this in a few hours - the main thing I'd like to check is the liveshare functionality

@renkun-ken
Copy link
Member Author

renkun-ken commented Mar 4, 2022

I'm trying to give those attached packages and loaded namespaces commands so that clicking them will trigger a quick pick of topics for that package. But it does not seem to be easily achievable with the existing help manager. @ManuelHentschel Any thoughts?

Resolved. Now clicking the package:foo items in Attached Namespaces or items in Loaded Namespaces will show quick pick of help topics of that package.

@ElianHugh
Copy link
Collaborator

I tried with LiveShare and everything seems to work nicely :)

Small nitpick - would it make sense to have the 'Global Environment' node expanded instead of closed by default? At present, it requires a click upon startup. This would be closer to the RStudio implementation of showing the global env by default

@renkun-ken
Copy link
Member Author

Small nitpick - would it make sense to have the 'Global Environment' node expanded instead of closed by default? At present, it requires a click upon startup. This would be closer to the RStudio implementation of showing the global env by default

It is expanded by default. See https://github.com/REditorSupport/vscode-R/pull/1022/files#diff-dc026a6295ecf05710e5e88e39d5a1a77d2d67c0a8e21b3ec2e23a6b97b985a1R37.

@renkun-ken
Copy link
Member Author

Now attached packages in "Loaded Namespaces" will display "attached" in the description:

image

@renkun-ken
Copy link
Member Author

Now if r.session.watchGlobalEnvironment is disabled, the "Global Environment" node will not show in the workspace viewer.

@ElianHugh
Copy link
Collaborator

The tooltip for the namespaces can be a little superfluous, e.g.
image

Would it be viable to have the result of packageDescription(package)[["Description"]] as the tooltip?

@renkun-ken
Copy link
Member Author

renkun-ken commented Mar 5, 2022

Would it be viable to have the result of packageDescription(package)[["Description"]] as the tooltip?

I thought about this. To avoid overhead, we don't want to write the package description to workspace.json repeatedly. The package information could be obtained from globalRHelp but it looks like the package nodes are only populated when the nodes need to be displayed. Therefore, in the workspace viewer, I delayed forcefully populating those populated nodes to when it is clicked.

If we put the package description in the tooltip, then we need to forcefully populate globalRHelp's package index earlier, when the workspace viewer needs to populate tree items. Let me see if it works nicely.

@renkun-ken
Copy link
Member Author

Would it be viable to have the result of packageDescription(package)[["Description"]] as the tooltip?

Done via ac44caa.

@renkun-ken renkun-ken merged commit 38b9f44 into REditorSupport:master Mar 5, 2022
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.

Show Environment Package Stack

2 participants