REditorSupport / REditorSupport/vscode-R

Unable to auto-indent when maximum length is exceeded (using the auto-formatting provided by the LSP)

Open
#1,407 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug stale
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug
When exceeding the max-line-length, the LSP raise a warning called "Lines should not be morn than your_max_line_length characters. line_length_linter"(See the following fig)
image
I tried to reformat the file using the format function provided by R LSP, but it didn't work for this issue. We know that in Python, there are some formatters like black and autopep8 which can handle this issue easily. Moreover, the formatter in RStudio can auto-indent too. So I' m wondering if I can do something to fix this issue?

Can you fix this issue by yourself? (We appreciate the help)
Yes, I tried using a couple of packages used for formatting like formatR and styler. But it didn't work.

// R path for Mac OS X
"r.rterm.mac": "/opt/homebrew/bin/R",

// An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'
"r.source.encoding": "UTF-8",

// Keeping focus when running
"r.source.focus": "editor",

// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": true,

// Use bracketed paste mode
"r.bracketedPaste": true,

// Enable R session watcher
"r.sessionWatcher": true,

// Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)
"r.rtermSendDelay": 5,

Expected behavior
Auto-indent when maximum length is exceeded

  • OS: macOS
  • VSCode Version: 1.81.1
  • R Version: 4.3.1
  • vscode-R version: 2.8.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by tracing the VS Code LSP formatting entry point and how the max-line-length warning is produced, then compare that path with the reported expected auto-indentation behavior. Done means formatting handles lines exceeding the configured limit and the reported case is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.