vscode-code-outline
vscode-code-outline copied to clipboard
Feature Request: Change tree item name with setting
When using with markdown file, all symbols displayed in same level with different number of #
.
(It's better if vscode can produce a better symbol tree for markdown file, but it didn't now...)
It looks like:
It will be better if I can replace #
with something looks more clear.
I tried to edit the symbolOutline.js
with some simple change in getTreeItem()
:
name.replace(/^(##|#)/, '').replace(/^#+/, function(m){ return m.replace(/#/g, ' ');})
Then the outline tree looks like:
I hope it could be something in setting that user can use JavaScript to change item's name.
I'd rather avoid special-casing certain formats.
@patrys Yes. I think this setting could be used in a more generic way:
- Change "AxxxBxxxCxxx" to "axxx_bxxx_cxxx"
- Trim useless prefix
- Some kind of translating
- ...
@patrys Do you consider to accept PR for this issue?
I'm open for all proposals but I'd like to discuss this through before you spend time on an implementation. I don't think it's a good idea for someone to have to write code in setting files. JSON is not really suitable to express logic and evaluating random strings is a bad idea as there is no way to prevent the function from erasing all of your files (and it's not uncommon to track workspace config in git).
How about user can provide multiple pairs string to run replace
for item name?
"ItemNameReplace" : [
{"pattern":"/^(##|#)/", "replacement":""},
{"pattern":"/^#/", "replacement" : " "}
]