Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Big Ark update related to treatment of document and workspace symbols:
Fix ranges of comment sections ark#855
Closes Problem with breadcrumbs and special-comment based sections ark#846
Addresses Sticky scroll doesn't work in the editor when sections (
#### text ####
) are included in the file. #6137Treat
test_that()
tests as document symbols ark#856Addresses R: make outline and breadcrumbs work for tests and test files #1428
Emit functions passed as named arguments as document symbols ark#858 and Extend range of assignment symbols to end of node ark#860
Addresses Support R6 methods as document symbols #6546
Addresses R code outline not working in nested control flow elements #6107
Addresses Ark: Blocks in function calls should be included in outline #5241
Don't emit nested objects as document symbols ark#859
Addresses Nested objects in document outlines #8330
Emit R6Class methods as workspace symbols ark#861
Addresses Support R6 methods as workspace symbols #6549
Exclude comment sections from workspace symbols by default ark#866
Addresses Ctrl+click to go to function definition doesn't work if a comment contains the name of the function #4886
Collect sections in calls and emit them as document symbols ark#867
Addresses Support section headers inside list for outline #8402
Fix from @jennybc:
Addresses browseURL not opening folders and files with default apps #5486
Other updates:
Release Notes
New Features
test_that()
blocks now appear in the outline and breadcrumbs, and also support sticky scroll functionality (R: make outline and breadcrumbs work for tests and test files #1428).All functions passed as named arguments also gain outline, breadcrumbs, and sticky scroll support. This improves the UX for R6 methods in particular (Support R6 methods as document symbols #6546).
Added support for comment sections (like
# Title ----
) in function calls. This is especially useful for users of thetargets
package where it is common to have very large targets calls that can now be sectioned in the outline, with breadcrumbs and sticky scroll support (Support section headers inside list for outline #8402).R6 methods are now exported as workspace symbols. You now search for them with
Ctrl/Cmd + t
(Support R6 methods as workspace symbols #6549).New
positron.r.symbols.includeAssignmentsInBlocks
setting to control whether local variables in functions and nested{}
blocks (e.g. intest_that()
calls) appear in the outline. It's turned off by default to keep the outline focused on the overall structure of the file (Nested objects in document outlines #8330).New
positron.r.workspaceSymbols.includeCommentSections
setting to control whether comment sections (like# Title ----
) are exported as workspace symbols. When enabled, you can search for the sections withCtrl/Cmd + t
. This is disabled by default to keep symbol search focused on actual symbols (Ctrl+click to go to function definition doesn't work if a comment contains the name of the function #4886).browseURL()
in R now delegates to the operating system's default opener for inputs that are not recognized as a web URL or an HTML file (browseURL not opening folders and files with default apps #5486).Bug Fixes
The breadcrumbs and sticky scroll features now behave properly in the presence of comment sections like
# Title ----
(Sticky scroll doesn't work in the editor when sections (#### text ####
) are included in the file. #6137).Section comments nested in
{ }
blocks now appear in the outline R code outline not working in nested control flow elements #6107.When a comment section (like
# Title ----
) is emitted as workspace symbol, and it clashes with another top-level definition (such asTitle <- function() {}
), the "Go to definition" feature now always prioritizes the definition of regular functions and variables (Ctrl+click to go to function definition doesn't work if a comment contains the name of the function #4886).QA Notes
See linked Ark PRs.
I had to update E2E tests to:
Avoid making assumptions about whether local variables are included in the outline. This is now a user setting and we're still discussing the default. Even if we don't turn it off by default (which was the initial assumption), better not have E2E tests depend on that.
Outline elements no longer retrieve metadata, only the symbol name. The metadata seems too brittle to changes in backends, for instance the variables now include a summary of related problems, and this was included in the element string, causing a test failure.
@:ark
@:outline