oleg-shilo / codemap.vscode

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

Cannot create json setting for dedicated mapper #44

Closed RoyTeymant closed 3 years ago

RoyTeymant commented 4 years ago

Thank you for an excellent extension.

I am trying to extend the mapper for markdown files. When I add the required setting in the VS Code settings json file for the new dedicated mapper as follows:

"codemap.md": "D:\\Dropbox_local\\software\\V\\Visual Studio Code\\extensions\\mapper_md.js",

I receive the error:

Regex-based definition of the mapping rules for Markup syntax. Incorrect type. Expected "array".

Any advice would be much appreciated.

Thank you.

oleg-shilo commented 4 years ago

Sorry for the delayed response. It is a defect. I did not realize the way setting file in VSCode is processed prevents user from changing the config value type.

In your case the config value is declared in the default config as array (because it is a RegEx based mapper). You want to create a new dedicated mapper for the same syntax (MD) so the config value must become a string.

The only way out is to allow a new overloaded value via slightly different config name:

"codemap.overloaded.md": "D:\\Dropbox_local\\software\\V\\Visual Studio Code\\extensions\\mapper_md.js",

And this is what is done with the commit af48179 The fix vill be available with the very next release.

RoyTeymant commented 4 years ago

Thank you very much. I will wait for the next release and then try again with the config name you described above. Kind regards.

RoyTeymant commented 3 years ago

Thank you for the release.

Should I now be able to define "codemap.overloaded.md": ?

This configuration setting does not seem to be known to Visual Studio Code, or is there something else I need to refresh or install?

Thanks again.

oleg-shilo commented 3 years ago

codemap.overloaded.md cannot be recognized by VSCode as it is a custom user settings value. Just add the line as below to the settings.json file and the extension will read the setting at runtime:

"codemap.overloaded.md": "D:\\Dropbox_local\\software\\V\\Visual Studio Code\\extensions\\mapper_md.js",
RoyTeymant commented 3 years ago

Thank you. I will experiment.

RoyTeymant commented 3 years ago

Thank you once again. This is now working perfectly!

I went down this path because I wanted to capture headings in markdown files, eg

example heading level 1
=====================================================

example heading level 2
------------------------------------------------------------------------------------------

where the heading level is indicated by the underline style and hence is a multiline check and hence (if I understand correctly) requires a dedicated mapper.

RoyTeymant commented 3 years ago

As an aside, the Donate button on Github (or within Visual Studio Code which i guess is the same thing) doesn't seem to go anywhere.

oleg-shilo commented 3 years ago

Now it does. :o)

Sorry, It's rather embarrassing. I have moved my all projects web hosting to the GitHub pages but forgot to update the donations new url. Thank you for letting me know. Fixed now.