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

Running Save Participants with AL Format is slow since the VSCode January '20 update #5664

Closed
fvet opened this issue Feb 13, 2020 · 28 comments
Closed
Labels
al-format bug Product bug

Comments

@fvet
Copy link

fvet commented Feb 13, 2020

Describe the bug
We're actively using FormatOnSave for our al files. Until a week ago, everything worked fine and we did not notice a major delay when saving our files.

"[al]": {"editor.formatOnSave": true }

However, since the VSCode January '20 update, the release notes states that background tasks of extensions during save (such as the Format Document) now show in a notification window ("Running Save Participants ...")

We've seen cases where autoFormat now takes several minutes instead, forcing us to close the notification window. Maybe related, but since the last VS Code update, we also faced numerous times that files cannot be saved / closed, forcing us to kill VS Code.

Screenshots

image

Versions:

image

@sstalder
Copy link

I have the same exact issue since this update. Happening on vscode insiders and regular.

@lyonsbp
Copy link

lyonsbp commented Feb 19, 2020

I'm getting the same thing. Everything worked fine before the update, I am formatting using the Prettier extension.

@mikedizon
Copy link

Seeing the same issue

@fvet
Copy link
Author

fvet commented Feb 26, 2020

Disabling formatonsave and doing a manual format document seems to improve speed a lot ...

@Nikodermus
Copy link

Nikodermus commented Feb 28, 2020

Still seeing this in, format on save used to be fast and worked always, not only for [al], but happens also with .js, .jsx and stylus files.

Version: 1.42.1
Commit: c47d83b293181d9be64f27ff093689e8e7aed054
Date: 2020-02-11T14:44:27.652Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.0.0

@wubo0067
Copy link

wubo0067 commented Mar 4, 2020

I've also encountered this problem, “Quick Fixes” runs a long time.

@photocurio
Copy link

This issue is very annoying. I'm using PHP, PHP Code Beautifier, and PHP Codesniffer. I had to disable all three.

@ChiefORZ
Copy link

image

vsocde is trying to execute ESLint in my .sh files in an endless loop.

it is not definied in any config file that he should format it with eslint^^

// settings.json
{
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "[javascript]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "[json]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "atomKeymap.promptV3Features": true,
  "colorize.languages": ["css", "sass", "scss", "less", "postcss", "sss", "stylus", "xml", "svg", "javascript", "javascriptreact", "typescript", "typescriptreact"],
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
  "editor.largeFileOptimizations": false,
  "editor.minimap.enabled": true,
  "editor.renderIndentGuides": false,
  "editor.renderWhitespace": "none",
  "editor.rulers": [100],
  "editor.showFoldingControls": "always",
  "editor.tabSize": 2,
  "emmet.includeLanguages": {
    "javascript": "javascriptreact"
  },
  "emmet.syntaxProfiles": {
    "javascript": ["js", "jsx"]
  },
  "eslint._legacyModuleResolve": true,
  "eslint.alwaysShowStatus": true,
  "eslint.packageManager": "yarn",
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "files.associations": {
    "*.graphqls": "graphql"
  },
  "files.autoSave": "off",
  "files.eol": "\n",
  "files.participants.timeout": 0,
  "git.autofetch": true,
  "git.enableSmartCommit": true,
  "git.inputValidationSubjectLength": 72,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "javascript.validate.enable": false,
  "material-icon-theme.showUpdateMessage": false,
  "npm.enableScriptExplorer": true,
  "npm.scriptExplorerAction": "run",
  "peacock.affectActivityBar": false,
  "peacock.affectTitleBar": false,
  "peacock.favoriteColors": [{
    "name": "Angular Red",
    "value": "#b52e31"
  }, {
    "name": "Auth0 Orange",
    "value": "#eb5424"
  }, {
    "name": "Azure Blue",
    "value": "#007fff"
  }, {
    "name": "C# Purple",
    "value": "#68217A"
  }, {
    "name": "Gatsby Purple",
    "value": "#639"
  }, {
    "name": "Go Cyan",
    "value": "#5dc9e2"
  }, {
    "name": "Java Blue-Gray",
    "value": "#557c9b"
  }, {
    "name": "JavaScript Yellow",
    "value": "#f9e64f"
  }, {
    "name": "Mandalorian Blue",
    "value": "#1857a4"
  }, {
    "name": "Node Green",
    "value": "#215732"
  }, {
    "name": "React Blue",
    "value": "#00b3e6"
  }, {
    "name": "Something Different",
    "value": "#832561"
  }, {
    "name": "Vue Green",
    "value": "#42b883"
  }],
  "scm.defaultViewMode": "tree",
  "sync.autoDownload": false,
  "sync.autoUpload": false,
  "sync.forceDownload": false,
  "sync.gist": "140cb49bd5ae6404af78e9636059cd89",
  "sync.quietSync": false,
  "sync.removeExtensions": true,
  "sync.syncExtensions": true,
  "terminal.integrated.rendererType": "auto",
  "terminal.integrated.scrollback": 10000,
  "typescript.tsserver.log": "verbose",
  "window.zoomLevel": 0,
  "workbench.activityBar.visible": true,
  "workbench.colorTheme": "One Monokai",
  "workbench.editor.showTabs": true,
  "workbench.iconTheme": "material-icon-theme",
  "workbench.sideBar.location": "left",
  "workbench.startupEditor": "welcomePage",
  "workbench.tree.renderIndentGuides": "none"
}

@photocurio
Copy link

@ChiefORZ it looks like vscode-eslint is your formatter for javascript and JSON.

@ChiefORZ
Copy link

@photocurio ya, of course. but isnt it strange that he tried to convert a .sh with a formatter associated with javascript and JSON 😜

@atoader atoader added the bug Product bug label Apr 1, 2020
@sirpy
Copy link

sirpy commented Apr 27, 2020

experiencing this also lately. it works ok for a while after restart but then becomes slow.

@EmilDamsbo
Copy link
Member

@fvet Would you be able to provide some more information? Are you still experiencing this issue with the newest version of the AL extension and with a newer version of VS Code different from 1.42?
If you are still experiencing, would you please provide a minimal working example which reproduces the issue?

I suspect this issue might be more related to VS Code itself as per these two:
microsoft/vscode#88149
microsoft/vscode#92652

@fvet
Copy link
Author

fvet commented Aug 27, 2020

Past weeks, I've worked on the AL insider vsix (6.x version), now I'm working on AL Version 5.0.320540 and still experiencing the delay a lot, all linked to the 'FormatOnSave', disabling this solves the issue. I can't provide a repro here, since the project I'm working in contains 4500+ files. You can always remotely debug if really needed.

VS Code
Version: 1.48.2 (user setup)
Commit: a0479759d6e9ea56afa657e454193f72aef85bd0
Date: 2020-08-25T10:13:11.295Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.14393

@atoader
Copy link
Contributor

atoader commented Sep 7, 2020

Thanks @fvet ! We were concerned that the FormatOnSave is completely blocking the save experience. From our testing, it appears to be related to the performance of the format command when working with large projects. We will continue working on performance improvements in the next months and follow up.

@yurim108
Copy link

I had a similar problem with saving AL files: it took several minutes to do that. After setting the property "al.enableCodeAnalysis" to "false" in settings.json file the problem was solved. I don't know if it is exactly the same problem/reason, but VS Code was also showing, that the Formatter is running.

@fvet
Copy link
Author

fvet commented Nov 16, 2020

@yurim108, disabling CodeAnalysis is only a workaround. VS Code should be able to support both CodeAnalysis and AutoFormat next to each other in a single workspace. I'm often updating lots of objects (regex replace, ...) or when working with 'larger' objects / objects used in a wide area of the application, FormatOnSave just slows down the entire process, but don't want to give up CodeAnalysis, since we expect to be alerted on warnings / errors in the same operation.

@MBK75
Copy link

MBK75 commented Nov 25, 2020

I've had this issue seemingly for the life of BC AL development and it appears to be getting worse. Over the past two days, simple file changes will completely lock up VS Code not infrequently

@mjmatthiesen
Copy link

Same issue here. The format on save is slow, but so is the auto complete (ctrl+space), find references, go to source, etc. It all slows a lot in bigger projects. I don't know if the code analysis is what slows this down, or if it's just vs code struggling with larger files now.

@DCMK320
Copy link

DCMK320 commented Jan 20, 2021

Same. The issue is consuming so mush time that we had to turn it off.

@mboustedt
Copy link

Same issue, formatOnSave is currently way too time consuming.

VSCODE: 1.52.1
AL: v6.1.397164

@NKarolak
Copy link

As a workaround, I'm currently trying the following VS Code setting:
image

So far, with success.

@DCMK320
Copy link

DCMK320 commented Jan 21, 2021

After setting the property "al.enableCodeAnalysis" to "false" in settings.json file the problem was solved.

This was the work around for me.

@mjmatthiesen
Copy link

As a workaround, I'm currently trying the following VS Code setting:
image

So far, with success.

How large is your project / files? Even with this setting, it will still take 2-5 minutes, seemingly arbitrarily.

@NKarolak
Copy link

@mjmatthiesen Two apps with round about 200 AL files.

In case the setting changed nothing on your side: Have you checked whether it applies to the right scope (User, Workspace, Folder), thus it is not overruled by another scope setting?

@mjmatthiesen
Copy link

It's scoped to just the project. Regardless of file size, it struggles a lot, but maybe it's just a problem with the performance available.

@ralf-escher
Copy link

ralf-escher commented Jun 30, 2021

This bug still seems to be open.
We are working on a project with 1600+ AL files
Any solutions yet?

Version: 1.57.1 (user setup)
Commit: 507ce72a4466fbb27b715c3722558bb15afa9f48
Date: 2021-06-17T13:28:07.755Z
Electron: 12.0.7
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19042

@atoader
Copy link
Contributor

atoader commented Jul 5, 2021

@kalberes could you share some tips on how to mitigate this issue?

@kalberes
Copy link
Contributor

kalberes commented Jul 8, 2021

There is nothing new to be added but what has been said.
Format on save if enabled is very slow on large projects. The only thing to do is to disable it with this setting:
"[al]": { "editor.formatOnSave": false}
It could also be tried what @NKarolak has suggested to only format on modifications. But if the AL file is large (many hundreds of lines) than that may also be slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
al-format bug Product bug
Projects
None yet
Development

No branches or pull requests