REditorSupport / REditorSupport/languageserver
How can I let workspace show variables inside a function() environment when in `browser()` mode.
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 675
- Forks
- 118
- Avg merge
- 1d 37m
- Merged PRs (30d)
- 11
Description
Hi!
I'm using M1 mac now, and currently the arm build has some bugs so vscdebugger cannot run.
So now I have to resort to use the builtin debug functions like browser(), debug() to manually do debug in REPL using VSCode.
However, I find that while in browser() mode, the variables shown in the workspace window cannot be updated to the local environment with in the function call. even if I manually click the refresh button, the workspace do not update. Plus, the plots do not shown if the corresponding command is executed in browser() mode.
In contrast with RStudio, when browser() mode is on, the workspace window can show variables from different environment, for example, within a function call.
If tracking variables in different environment lively is a bit hard to be implemented, is there any way I can set a global variable to access variables in local environment and I can track it lively? (I don't want set the variables inside a function as a global variable, as it is generally not a good practice)
Thanks for your hardworking on this project and I would really appreciate it for any reply.
a = function(i) {
browser()
b = 0
for(i in 1:5) {
b = b + i
}
}
a()
# ideally, I can track b in the workspace window
Updates:
I find that even I set b as a global variable, in browser() mode the workspace still cannot track the b, even I click the manual refresh button right to the workspace window.
a = function(i) {
browser()
b <<- 0
for(i in 1:5) {
b <<- b + i
}
# ideally, I can track b in the workspace window
}
a()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is identified. Start by reproducing the example in the issue with R's browser() and the workspace refresh, then inspect how the language server discovers variables and plots while execution is paused. Done means local function-scope variables and plots are correctly reflected, or the supported limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100