oleg-shilo / codemap.vscode

Code map (syntax tree) of the active document
MIT License
84 stars 28 forks source link

Allow space in prefix #13

Closed MagTun closed 5 years ago

MagTun commented 5 years ago

To get nice indent in my custom code map, I would like to prefix the level 2 and 3 with spaces. But this doesn't work "prefix": " ",

I also tried this but still it doesn't work: "prefix": "\s",

I tried to prefix with tab, which works, but the tab create an indent that is too large "prefix": "\t",

Would it be possible to add spaces as prefix?

And thanks a lot for your great extension and the nice tuto "Adding custom mappers"!

Extension version: 1.8.0

oleg-shilo commented 5 years ago

VSCode TreeView items doe not allow spaces as leading character. VSCode trims all of them. I faced the same challenge when implementing this extension. The only way to solve it is to use non space character that happens to have no graphical content. Ifound one unicode character like that. You can copy it from this setting:

"codemap.textModeLevelPrefix": "   ",

In fact you can use the very same setting to control the width of the all levels.

Remember, in order for the change to take the place you need to trigger tree view repainting (e.g. switch tabs).

MagTun commented 5 years ago

That's perfect.

Github removed the character, but I was able to find it in C:\Users\<user>\.vscode\extensions\oleg-shilo.codemap-1.8.0\package.json.

I just had to search for textModeLevelPrefix, and to copy the character inside the quote (in package.json the character is set twice).