Sublime Forum

`index_exclude_patterns` ignores open files

#1

I just noticed that index_exclude_patterns is ignored for open files. Is that a feature or a bug?

What I actually wanted to do is to exclude open/unnamed or scratch buffers. For example I load a past revision of a file in a buffer - “git show…” - for comparison or rewrite or try something in a scratch buffer. I would like to suppress these buffers when doing goto definition/references.

Now I can even imagine a small plugin excluding all files temporarily because then I’m still able as it seems to jump around in the set of open buffers. This could come in handy. :thinking: Excluding all is just a "*"?

Anyway, is there a way to suppress scratch, temporary buffers from appearing in the goto symbol menus? (Maybe a view setting?)

0 Likes

#2

AFAIK “index” and “open files” are two different source of information, which have always been treated indepentendly.

For instance Goto Definition even works across open files with indexer being disabled.

0 Likes

#3

Yeah, I see a useful feature here. Disabling index for all files or for all but the folder of the current file temporarily is maybe even worth a key-binding.

But how can I exclude scratch buffers or for example GitSavvy’s special buffers from appearing in the Goto definitions et.al. panels?

0 Likes

#4

Goto Definition relies on ShowInIndexedSymbolList setting.

If your buffers use dedicated syntax (e.g. source.gitsavvy), it should be enough to hide default entries with a Hide Symbol Index.tmPreferences (any file name is possible).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>scope</key>
    <string>
        source.gitsavvy entity.name.function,
        source.gitsavvy entity.name.type,
        source.gitsavvy entity.name.class,
        source.gitsavvy entity.name.enum,
        source.gitsavvy entity.name.namespace
    </string>
    <key>settings</key>
    <dict>
        <key>showInIndexedSymbolList</key>
        <string>0</string>
    </dict>
</dict>
</plist>
0 Likes

#5

They don’t use special syntax. They just show an old version of a file for example. So they naturally have the same syntax applied and since they’re read only some key bindings for navigation etc.

The very special buffers “git status”, “commit” do not show up in Goto Definition because of their special syntax.

But for example, the diff and log buffers (Repo/File History) do show up in Find in Files which is also annoying. (Actually everything is in Find in Files.)

But really also my own scratch, temporary buffers always appear in Goto Definition. :shrug:

0 Likes

#6

The “show historical version of a file” buffers use the standard syntaxes, so for example source.python. Could I just augment them so they become gitsavvy source.python?

0 Likes

#7

I am not aware of a sane solution to achieve that.

Appears a feature requestion is the only option then.

I wonder whether it makes sense to ask for a dedicated flag/setting which can bie modified via API to include/exclude certain views/widgets.

FWIW: I am personally fine with Goto Definition working in all kinds of open documents, even if they show out-dated revisions.

0 Likes

#8

Hm, now that you say “views/widgets”. There is this is_widget flag/setting. Could it be that … <hack, hack> … nah, does nothing.

I actually have no idea what side-effects is_widget=true has. Only remember Termius is setting it. I think it excludes the view from go back/forth navigation.

0 Likes