Anyway I want symbols.
Sometimes there is no language support like FooLang-mode or language server,
such that works well with symbols (jump between them or so).
But you want to edit files right now -- in my case,
and PonyLang files.
So let's rely on ctags' power.
How to use
This extension works the cases than you operate on files by 'Open Workspace' or by 'Open Folder',
and does not work for the case of 'Open File'.
At first, prepare tags file, and then, activate this extension by
Symbol by Ctags command.
tags file name is one of
If your tags file is load and your target file has symbols, some changes will happen.
Some items will be appear within
Outline pane of
and you can search symbols by typing it's name
Ctrl+Shift+O (or type
(keybinds depends on your settings and physical keyboard. I use japanese keyboard on Windows 10.).
Since 0.10.0, you can workspace-wide symbol search via
Ctrl+T (case-sensitive and rough).
Two commands are provided.
Currently, we support two formats, and need LineNumber.
# this is output of Exuberant Ctags
# for example, `ctags -f .tags --sort=no --excmd=number *`
# Symbol Name \t File Name \t LineNumber;" \t Type of Symbol(1 length)
WordHandler main.pony 8;" c
apply main.pony 17;" f
# this is another output format of Exuberant Ctags.
# for example, `ctags -f tags --sort=no --fields=nksaSmtf *`
# Symbol Name \t File Name \t regex;" \t Type of Symbol(1 length) \t line:LineNumber \t something...
WordHandler main.pony /^class WordHandler is ReadlineNotify$/;" c line:8
apply main.pony /^ fun ref apply(line: String, prompt: Promise[String]) =>$/;" f line:17
# this is output of rst2ctags.py
# for example, `python x:/path/to/rst2ctags.py -f .tags --sort=no foo.rst bar.rst baz.rst`
# Symbol Name \t File Name \t regex;" \t Type of Symbol(1 length) \t line:LineNumber \t something of structure(if exists)
RootSection foo.rst /^RootSection$/;" s line:2
hello foo.rst /^hello$/;" s line:183 section:RootSection|ParentSection
world foo.rst /^world$/;" s line:6 section:RootSection
target array has settings-objects for each lauguage,
and each settings-object has some properties.
name: string. some description.
glob: Glob string.
**/*.rst or so.
reference for Glob
ends: array of string used to match settings with files. [
.rst ] or so.
kindMap: object. Mapping ctag's
kind (1 length string) to VS Code's
reference for SymbolKind
restartTree: string composed of Type of Symbol(each has 1 length).
If the type of symbol is included in this string,
the symbol is top of tree and has symbols that appear after 'top' and before next 'restart', as a child.
That is, you can have only 1 level depth trees.
sro: string that is Scope Resolution Operator (borrowed from Vim's great Tagbar by majutsushi).
This works for tags files of extended form, such as one by
In this case, you can have greater than 1 level depth trees.
offSideRule (experimental): boolean, and do not work with
For languages of off-side rule (Pony, F#, Python, ...),
symbol tree have nested structure corresponding to indent level.
I felt that elaborating this will not have so nice effects,
because apparently we can not cover so much pattern of code-structure.
But we may get more accurate range of each definition and utilize that for other feature,
so this experiment happened.
For workspace following, write to
"editor.tabSize": 2, // or so...
"name": "reStructuredText(just description)",
"ends": [ ".rst" ],
"ends": [ ".pony" ],
// or "offSideRule": true
In the case that you use 'Open as folder', write to
// some settings
- [author want] working without tags file.
- [author want] 'fixed reference' to tags file of some basic repository.
- [author maybe want] completion. but
sro may not be simple, e.g.
.> and so.
In short, the capability is limited very much, and under dogfooding.
Maybe all things are easy to be changed, excuse me.
need to be activated by command, intended not to bother other extensions.
"workspaceContains:**/.tags" or so ~~may be better~~ is not appropriate,
because project may have tags file and want this extension not to work at all.
do not jump between files like a
go to definition, other than
do not rename.
do not generate ctags file.
do not see the change of ctags file instantly. If re-open the file, changes will be effected.
do not watch the change of settings file. If re-open workspace, changes will be effected.