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

Native vscode formatting + formatter performance #35

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

matthewnitschke-wk
Copy link

@matthewnitschke-wk matthewnitschke-wk commented Feb 8, 2025

Reworked internals of formatting to better align to vscode's best practices. Also leverages some internal techniques to improve formatting performance

The result of this pr is a full file save format running in ~10ms. This provides a much improved DX, similar to that of using the default dart format functionality. Example of this running is as follows:

Screen.Recording.2025-02-09.at.6.48.05.PM.mov

Due to adhering to the registerDocumentFormattingEditProvider we're also able to tap into vscodes default formatting functionality. This means the "Format Document" action/hotkey should work out of the box (with eventual support for "format selection", and "format modified lines")

Because of these changes, some configuration settings will need to be updated, and as such, this PR is a major. The changes to settings.json are as follows:

// disable Dart-Code's formatter
"dart.enableSdkFormatter": false,

"[dart]": {
  // Specify the default formatter to use this extension
  "editor.defaultFormatter": "Workiva.over-react-format-on-save",
  
  // Optionally enable "formatOnSave"
  "editor.formatOnSave": true
},

Details

@matthewnitschke-wk matthewnitschke-wk changed the title use dart dev Native vscode formatting + dart_dev executable Feb 8, 2025
@matthewnitschke-wk matthewnitschke-wk changed the title Native vscode formatting + dart_dev executable Native vscode formatting + formatter performance Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop spamming output tab every time a file saves
2 participants