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

Implement RStatementRangeProvider #1227

Merged
merged 5 commits into from
Sep 6, 2023

Conversation

DavisVaughan
Copy link
Contributor

@DavisVaughan DavisVaughan commented Sep 5, 2023

Joint with posit-dev/ark#85
Part of #1213
Part of #394

This currently has the behavior where if you hit CMD+Enter within a function definition (like on line 1 + 2 in the video) then it will send the entire function to the console rather than the current line (similar behavior occurs within a function call). RStudio does the opposite, but I actually don't mind this new behavior all that much, and the implementation is very simple for now. You can always opt out of this by doing a manual selection of 1 + 2 and sending just that to the console

Screen.Recording.2023-09-05.at.1.53.44.PM.mov

After this PR (both of which I'll look at):

  • Small bug related to Bug in StatementRangeProvider usage #1231
  • Tweak provideStatementRange() to allow | undefined all the way through, rather than catching and erroring on it here
    const providerRange = await this._provider.provideStatementRange(document, position, token);
    if (!providerRange) {
    this._logService.debug(`No statement range from provider ` +
    `for position ${position} in ${resource}`);
    throw new Error(`Invalid statement range returned from provider ` +
    `for ${position} in ${resource}`);
    }

@DavisVaughan DavisVaughan marked this pull request as ready for review September 5, 2023 17:43
extensions/positron-r/src/lsp.ts Outdated Show resolved Hide resolved
extensions/positron-r/src/statement-range.ts Outdated Show resolved Hide resolved
extensions/positron-r/src/statement-range.ts Show resolved Hide resolved
extensions/positron-r/src/lsp.ts Show resolved Hide resolved
extensions/positron-r/src/statement-range.ts Show resolved Hide resolved
@DavisVaughan DavisVaughan force-pushed the feature/statement-range-provider-r-extension branch from ac49fb0 to 3bd6d93 Compare September 6, 2023 14:15
@DavisVaughan DavisVaughan merged commit 9283987 into main Sep 6, 2023
@DavisVaughan DavisVaughan deleted the feature/statement-range-provider-r-extension branch September 6, 2023 14:15
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.

2 participants