atom-ctags icon indicating copy to clipboard operation
atom-ctags copied to clipboard

Very slow on large number of tags (yet works fine in vim)

Open rubenwardy opened this issue 6 years ago • 6 comments

The linux kernel has a large amount of symbols. Searching for a tag in vim is very fast - no noticeable delay - but in atom with this plugin it is very slow to find something, partially due to searching on every keypress. I suggest adding a delay to the search so that it doesn't search for every key press, and also using concurrency.

@jdanbrown maybe this is something you could add to your fork? Would be good if you could open issues on your fork too

rubenwardy avatar Jun 18 '18 12:06 rubenwardy

@jdanbrown 's fork fixes this for me

rubenwardy avatar Jun 18 '18 12:06 rubenwardy

The fork makes the editor lag massively in other places, including editing the file and using the project tree-view

rubenwardy avatar Jun 18 '18 13:06 rubenwardy

@jdanbrown maybe this is something you could add to your fork? Would be good if you could open issues on your fork too

I hesitate to for-real fork this package since I don't have much time to put into it right now, but I'd welcome someone else doing it if they wanted to get all the open PRs and issues organized. In the meantime, I vote let's keep all the discussion in this repo.

The fork makes the editor lag massively in other places, including editing the file and using the project tree-view

Hmm, that's possible but I'm skeptical since the atom-ctags commits I added don't appear to be very intrusive. Maybe double check that my fork is actually what's causing those other lags (e.g. not some other package)?—that might solve both of your problems.

jdanbrown avatar Jun 18 '18 16:06 jdanbrown

Thanks for your quick response. Disabling the package removes the lag. It's possible that the parent plugin also has this issue - it only appears after 5/10 minutes of using it

I tried modifying the coffeescript to disable the callback that watches the editor, but to no effect. I've never done coffeescript or made an atom plugin. I didn't spend much time trying to find callbacks on editor actions though, so may have missed it.

Do you have to recompile the .coffee somehow, or does atom do that automatically?

Patch
diff --git a/lib/main.coffee b/lib/main.coffee
index c689549..0a830e0 100644
--- a/lib/main.coffee
+++ b/lib/main.coffee
@@ -10,6 +10,10 @@ module.exports =
       title: 'Disable auto complete'
       type: 'boolean'
       default: false
+    disableGoto:
+      title: 'Disable goto'
+      type: 'boolean'
+      default: false
     autoBuildTagsWhenActive:
       title: 'Automatically rebuild tags'
       description: 'Rebuild tags file each time a project path changes'
@@ -69,15 +73,16 @@ module.exports =
       'atom-ctags:go-to-declaration': => @createFileView().goto()
       'atom-ctags:return-from-declaration': => @createGoBackView().toggle()
 
-    @disposables.add atom.workspace.observeTextEditors (editor) =>
-      editorView = atom.views.getView(editor)
-      {$} = require 'atom-space-pen-views' unless $
-      $(editorView).on 'mousedown', (event) =>
-        which = atom.config.get('atom-ctags.GotoSymbolClick')
-        return unless MouseEventWhichDict[which] == event.which
-        for keyName in atom.config.get('atom-ctags.GotoSymbolKey')
-          return if not event[keyName+"Key"]
-        @createFileView().goto()
+    if not atom.config.get('atom-ctags.disableGoto')
+      @disposables.add atom.workspace.observeTextEditors (editor) =>
+        editorView = atom.views.getView(editor)
+        {$} = require 'atom-space-pen-views' unless $
+        $(editorView).on 'mousedown', (event) =>
+          which = atom.config.get('atom-ctags.GotoSymbolClick')
+          return unless MouseEventWhichDict[which] == event.which
+          for keyName in atom.config.get('atom-ctags.GotoSymbolKey')
+            return if not event[keyName+"Key"]
+          @createFileView().goto()
 
     if not atom.packages.isPackageDisabled("symbols-view")
       atom.packages.disablePackage("symbols-view")

rubenwardy avatar Jun 18 '18 17:06 rubenwardy

Sorry for the necropost.

I also just ran into this issue after adding the FontAwesome folder to my small practice website project folder. That added folder's main "all.css" file already has almost 4400 lines, so yeah. Couldn't for the life of me figure out what was causing the problem until I started to randomly delete stuff to revert the folder to the state it was in before it started to massively lag.

At first, it gave a linter timeout error, which made it even more confusing, but I eventually narrowed it down to be atom-ctags in combination with autocomplete-plus.

Has anyone in the meantime figured out how this issue could be fixed?

Caedendi avatar Aug 14 '19 10:08 Caedendi

I switched to vscode a few months ago, so I'm no longer vested in this issue. Hope you find a solution

rubenwardy avatar Aug 14 '19 10:08 rubenwardy