Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings don't work? #2

Closed
peekxc opened this issue Jun 10, 2024 · 6 comments
Closed

Settings don't work? #2

peekxc opened this issue Jun 10, 2024 · 6 comments

Comments

@peekxc
Copy link

peekxc commented Jun 10, 2024

Using the example supplied in the Readme, which in my settings.json looks like:

"regexpOutline.headerRulesEachExt": "[{"ext":".txt","rules":[{"level":1,"format":"^■(.+)$","nameIdx":1,"detail":"H1"},{"level":2,"format":"^□(.+)$","nameIdx":1,"detail":"H2"},{"level":3,"format":"^▼(.+)$","nameIdx":1,"detail":"H3"}]}]"

I created a test.txt file with the following content:

■ Header 1
Testing...
□ Sub-header
Another test....

And nothing shows up in the outline. How to get the extension to work? Also, It's a little strange all the strings/format inputs have to be in a compressed/line-escaped string; I don't see why this is necessary.

It would be great if this would work, as then it would be easy to add support for the percent-format in *.py files, per this issue

@longfish801
Copy link
Owner

Maybe there is a way to set up multiple lines for settings.json ...
But, I don't know how to do it !!
So Regexp Outline is designed to be set up in one line.
You can format json data to single line (minify) with web application such a JSON整形ツール:JSON Formatter or VSCode extension JSON Tools.

@peekxc
Copy link
Author

peekxc commented Jun 11, 2024

Ahh even using the tool the settings do not work for me at all I'm afraid

@longfish801
Copy link
Owner

Are you still setting directly in settings.json?

The set value must be set to a JSON string, not JSON.
Directly setting in settings.json, you need to escape double quotes etc.
Here is sample.

    "regexpOutline.headerRulesEachExt": "[{\"ext\":\".txt\",\"rules\":[{\"level\":1,\"format\":\"^■(.+)$\",\"nameIdx\":1,\"detail\":\"H1\"},{\"level\":2,\"format\":\"^□(.+)$\",\"nameIdx\":1,\"detail\":\"H2\"},{\"level\":3,\"format\":\"^▼(.+)$\",\"nameIdx\":1,\"detail\":\"H3\"}]}]",

If this does not work, other extensions may be the cause.
Try disabling all other extensions and enabling only RegexpOutline.

@peekxc
Copy link
Author

peekxc commented Aug 9, 2024

Yeah, even with copy-pasting the above into my JSON settings, nothing shows up.

Interestingly, after changing the ".txt" to the ".py" I was able to get the regexpoutline tab to show up in the outline view. However, none of the rules seem to work

Screenshot 2024-08-09 at 11 08 43 AM

With either:
Screenshot 2024-08-09 at 11 08 49 AM

Or with:

Screenshot 2024-08-09 at 11 11 15 AM

Here's my rules, verbatim from the settings.json file:

"regexpOutline.headerRulesEachExt": "[{\"ext\":\".py\",\"rules\":[{\"level\":1,\"format\":\"^■(.+)$\",\"nameIdx\":1,\"detail\":\"H1\"},{\"level\":2,\"format\":\"^□(.+)$\",\"nameIdx\":1,\"detail\":\"H2\"},{\"level\":3,\"format\":\"^▼(.+)$\",\"nameIdx\":1,\"detail\":\"H3\"}]}]"

@longfish801
Copy link
Owner

Interestingly, after changing the ".txt" to the ".py" I was able to get the regexpoutline tab to show up in the outline view. However, none of the rules seem to work

Then, the other extensions may be the cause.
Try disabling all other extensions, and enabling only RegexpOutline.

@longfish801
Copy link
Owner

Closed due to no progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants