pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.33k stars 140 forks source link

Extremely slow when openin large js file (800-1000 lines of code) #892

Open vol4ikman opened 9 months ago

vol4ikman commented 9 months ago

Thanks in advance for your bug report!

What happened?

After updating up to 1.113.0 version, when I open large JS files (800+ lines of code) the editor extremely slow!!! I think it is because the new TreeSitter update.....

Pulsar version

1.113.0

Which OS does this happen on?

🪟 Windows

OS details

Windows 11 x64

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

Just open a large JS file 800+ lines of code

Additional Information:

No response

savetheclocktower commented 9 months ago

I routinely work on a 4200-line JavaScript file without incident, so this may have to do with window state or something related. Let's try the following things in order:

  1. Run in safe mode — pulsar --safe from the command line. If the editor isn't slow, then…
  2. Try clearing window state with pulsar --clear-window-state to see if that fixes your situation outside of safe mode.
  3. If not, open your config folder (open Settings, then click “Open Config Folder“ button in the sidebar). Close Pulsar, back up your entire profile directory, then empty the contents of the blob-store and compile-cache folders. Relaunch Pulsar. Things may be slow for a little while as it repopulates those caches, but leave it for about ten minutes, then try editing your file again.See if it's faster.
  4. If not, back up your entire profile folder to another location, then delete it. Launch Pulsar; it will recreate your profile folder. If this is fast, then copy your packages from the backup location to the packages directory.

I experienced a similar issue recently when juggling versions and --clear-window-state seemed to solve it for me. I hope you won't have to go too far down this list, but If none of these ideas solves the problem, let me know.

vol4ikman commented 9 months ago

"pulsar --safe" returns to me "The term 'pulsar' is not recognized as the name of a cmdlet, function, script file, or operable program."

savetheclocktower commented 9 months ago

Go into Settings, click on the “System” item in the sidebar, then enable either the Add Pulsar to PATH (User Install) setting or the Add Pulsar to PATH (Machine Install) setting, depending on whether you installed Pulsar just for yourself or for all users. Then pulsar should be available in command prompts. (You may have to close your prompt and launch a new one.)

vol4ikman commented 9 months ago

image

I can not select the checkbox It is installed for eveone

savetheclocktower commented 9 months ago

Try running Pulsar as an administrator — right-click the Pulsar icon and choose “Run as Administrator,” I think.

vol4ikman commented 9 months ago

I am trying as an admin - it's still uncheckable

savetheclocktower commented 9 months ago

OK, I'm going to see if a Windows user on our core team can help you out with these steps. In the meantime, you can try some of the other steps if you like.

vol4ikman commented 9 months ago

Thanks

DeeDeeG commented 9 months ago

First, yeah, if not running Pulsar as administrator, it's greyed out and disabled (cursor becomes đźš«).

If running Pulsar as administrator, the checkbox is checkable but spawned an error on my machine.

It probably needs Set-Executionpolicy Unrestricted prior to running?

(https://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts, https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.4#-executionpolicy)

In which case we might want to rethink "Adding it to path for all users" for machine-wide (for all users) Pulsar installs, and instead only ever add it to PATH per-user, regardless of how it was installed/for whom? I don't feel like having this execution policy as Unrestricted is a best practice I'd want for my own machines, and the reality is it's Restricted by default, so this won't work by default for most users, I'd think.

Powershell Script Error when adding Pulsar to PATH (system)

Error Running Script: Error: Command failed: C:\PROGRA~1\Pulsar\resources\modifyWindowsPath.ps1 -installMode Machine -installdir "C:\PROGRA~1\Pulsar" -remove 0 C:\PROGRA~1\Pulsar\resources\modifyWindowsPath.ps1 : File C:\Program Files\Pulsar\resources\modifyWindowsPath.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/[go.microsoft.com/fwlink/?LinkID=135170](http://go.microsoft.com/fwlink/?LinkID=135170). At line:1 char:1

    C:\PROGRA~1\Pulsar\resources\modifyWindowsPath.ps1 -installMode Machi ...

      + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
confused-Techie commented 9 months ago

@DeeDeeG You make some good points about issues with adding Pulsar to the path via a machine install, but at the very least I would expect some sort of error message if @vol4ikman is running as an admin. Since now matter what something should show up, as iirc the result of running that Powershell file is hooked up to the notifications no matter the exit code, even just to say if it went successfully.

@vol4ikman If Pulsar is running as administrator and there is no response to adding to the path, then that's a totally separate issue that we might have to look into, as I'd expect to see something happen. Otherwise, in the meantime, following a guide like this can help you add something to your PATH. Since you did a machine install of Pulsar, you've customized your installation path, so hopefully you know where Pulsar was actually installed. But for the rest of my instructions I'll refer to wherever you told Pulsar to install as the <RESOURCE_PATH>.

You'll then want to add the following entries to your PATH:

Once you've done that you'll now need to relaunch your terminal/powershell/cmd instance, and you should now be able to use pulsar --safe in the command line

savetheclocktower commented 9 months ago

And all this was just to diagnose why he was dealing with poor editing performance. After all this trouble, if pulsar --safe doesn't at least help solve the mystery, I'll be heartbroken.

Daeraxa commented 9 months ago

Can Application: Open Safe not just be used to open in safe mode instead? Don't think the other command has one. Edit - Not actually sure what that does, opens a file dialog? Guess it forces you to open a folder or file in safe mode.

savetheclocktower commented 9 months ago

Can Application: Open Safe not just be used to open in safe mode instead? Don't think the other command has one. Edit - Not actually sure what that does, opens a file dialog? Guess it forces you to open a folder or file in safe mode.

(I didn't even know that existed)