editorconfig-notepad-plus-plus icon indicating copy to clipboard operation
editorconfig-notepad-plus-plus copied to clipboard

Extremely slow on local LAN

Open cvladan opened this issue 3 years ago • 5 comments

Files are stored on Raspberry Pi where Home Assistant is installed. I'm using an official Add-on: Samba share to access config .yaml files from Windows 10 desktop computer.

When this plugin is installed in Notepad++, reading is very, really very slow ~ like 4-5 sec. And this lag delay is repeating every time I switch files tabs.

Notepad++ has no problem when this plugin is not installed. Other editors like Notepad, VSCode, ST3 also have no visible problem.

Notepad++ is installed using Scoop package manager with scoop install notepadplusplus

I've solved my problem now but decided to submit this bug ticket to warn and help other Hass.io users that can have similar problems.

cvladan avatar May 27 '21 15:05 cvladan

I've solved my problem now but...

How did you solve the problem?

ffes avatar May 27 '21 15:05 ffes

I've solved my problem now but...

How did you solve the problem?

Solved by uninstalling editorconfig plugin

cvladan avatar May 28 '21 02:05 cvladan

If the slowness is happening on every tab switch, perhaps the plugin isn't caching the results of this search on a per-tab basis and is instead searching for (and reading) .editorconfig files every time you switch between files.

Yep, looking at src/NppPluginEditorConfig.cpp it seems the entire loading process happens every time NPPN_BUFFERACTIVATED happens, which according to src/Notepad_plus_msgs.hpp is

// To notify plugins that a buffer was activated (put to foreground).

So on every tab switch it does: loadConfig > parseConfig > (editorconfig-core-c) editorconfig_parse > get_filenames which is going to be slow if traversing network shares.

The spec at https://editorconfig.org/#file-location says:

When opening a file, EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory.

so it seems this should only be done once when a file is opened?

sparrowt avatar Jul 29 '21 09:07 sparrowt

Furthermore, it seems like the plugin is traversing all the way up to the server of a UNC share. i.e.:

   \\server\path\file.txt
-> \\server\path\.editorconfig
-> \\server\.editorconfig
-> \\.editorconfig

The last 2 of which should never be attempted because the UNC paths have to be a directory, and the toplevel refers to a host. Imagine a host being called .editorconfig (not legal, but can't guess what happens...)

Edit: It seems to be within the core editorconfig library: https://github.com/editorconfig/editorconfig-core-c/blob/082268b/src/lib/editorconfig.c#L519, the path splitting algorithm isn't UNC-aware.

lowjoel avatar Oct 23 '23 00:10 lowjoel

Thanks @lowjoel for the great feedback. I have opened editorconfig/editorconfig-core-c#98 in the core-c repo to report this problem.

ffes avatar Oct 23 '23 07:10 ffes