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

CodeActionsOnSave is terribly slow (AL <> AL code outline) #261

Closed
fvet opened this issue Jul 19, 2021 · 2 comments
Closed

CodeActionsOnSave is terribly slow (AL <> AL code outline) #261

fvet opened this issue Jul 19, 2021 · 2 comments
Labels

Comments

@fvet
Copy link
Contributor

fvet commented Jul 19, 2021

We've tried to start fixing some of the code warnings by having variables / properties sorted upon saving the file.

"alOutline.codeActionsOnSave": [
        "SortProperties",
        "SortVariables"
    ],

However, AL is acting terribly slow (microsoft/AL#5664) in larger projects (4700+ files) when formatOnSave is enabled (even on files with a few hundred code lines) and it does not seem like we should expect any fixes soon from MS :( Disabling formatOnSave is not the answer we'd expected.

Is there any workaround / better way to have the SortProperties / SortVariables (manually) ran as part of a Code Action, separate commandlet, ... instead of upon saving the file? Right now, we need to wait 10+ minutes untill we then finally decide to cancel the save/format operation.

@anzwdev
Copy link
Owner

anzwdev commented Jul 20, 2021

If you remove these actions from "alOutline.codeActionsOnSave" setting, then you can run them manually by moving cursor to object keyword (page/codeunit/table/...) or object name and then clicking on the yellow bulb. These actions should be visible in the menu that will be opened.

@anzwdev anzwdev mentioned this issue Jan 2, 2022
anzwdev added a commit that referenced this issue Jan 2, 2022
 - Issue #249 - Reuse tooltip from other pages
   - new commands `Refresh ToolTips from Dependencies in the Active Editor/Project` to refresh page field tooltips from existing tooltips defined in dependencies
   - page wizard, `add multiple fields` code action and `Add ToolTips to the Active Editor/Project` commands reuse tooltips from other pages
   - in both cases listed above, if there are more different tooltips defined for a field, a first one that logic finds will be used
   - new `Reuse tooltip from other pages` code action available on page and page extension fields and on ToolTip property
   - reusing tooltips in page wizard, `add multiple fields` code action and `Add ToolTips to the Active Editor/Project` commands can be disabled by setting `alOutline.doNotReuseToolTipsFromOtherPages` setting to true, source of tooltips can also be limited to selected dependencies using `alOutline.reuseToolTipsFromDependencies` setting
 - Issue #215 - Empty lines at end of new files
   - new setting "alOutline.noEmptyLinesAtTheEndOfWizardGeneratedFiles"
 - Issue #261 - CodeActionsOnSave is terribly slow (AL <> AL code outline)
   - CodeCop warning fixes code actions are disabled by default, they can be enabled by changing "alOutline.enableCodeCopFixes" setting to true
   - "FormatDocument" value has been added to the list of available actions in "alOutline.codeActionsOnSave" setting
 - Issue #275 - Symbols Browser - Go to definition (project file or server definition) - shared file access fix
 - Issue #295 - New "Code Cleanup" commands for workspace, editor and uncommited only workspace files
 - Issue #295 - New "Lock Removed Table Field Captions" commands for workspace and editor
 - Issue #300 - Idea: Fix begin..end (AA0005) warnings in project/editor
 - Issue #301 - PermissionSet wizard - PermissionSet name length cannot be longer than 20 characters
 - Issue #306 - Add MaxLength property to Caption when Permission Set is created
 - Issue #307 - Allow the Syntax Visualizer sash to be moved further
 - Issue #308 - If possible, only show context menu items when relevant
 - New structure of problems reported by CodeCop was preventing CodeCop code action fixes from running
@anzwdev
Copy link
Owner

anzwdev commented Jan 2, 2022

Hi

I've released a new version of the extension, it contains a few fixes that should help you with performance issues with large al projects:

  1. CodeCop warning fixes code actions are disabled by default, they can be enabled by changing "alOutline.enableCodeCopFixes" setting to true. I had to do it, because they need diagnostics reported by al code analyzers to work which means that whole visual studio code actions discovery process would have to wait for CodeCop/Microsoft AL Extension to finish parsing ana analyzing current solution.
  2. I've added "FormatDocument" value to the list of available actions in "alOutline.codeActionsOnSave" setting. You can try to disable standard document formatting which is done by Microsoft AL Extension and enable this one. It could help as mine extension should not be so busy parsing files so VS Code won't have to wait so long for the result. But don't expect it to always return results immediately. I've found during my tests that when you enable code analyzers and open very big al projects, Microsoft AL Extension sometimes can use 100% of processor power not leaving much to other processes, so saving document can still take 2-3 seconds.

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

No branches or pull requests

2 participants