vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
812 stars 129 forks source link

Edit Table of Contents style intention dialog has no effect #840

Open InvisibleSmiley opened 4 years ago

InvisibleSmiley commented 4 years ago

I started with something like this:

# API

[TOC]: #

## Definitions

### foo
bar

Then used the "Update Table of Contents" intention. That removed my custom "Definitions" heading but OK, I manually fixed that, arriving at this:

# API

[TOC]: #

# Table of Contents
- [Definitions](#definitions)
  - [foo](#foo)

## Definitions

### foo
bar

Now I tried to use the "Edit Table of Contents style" intention on the TOC line. But no matter what I did in that dialog, pressing OK had no effect other than closing the dialog. Trying again resulted in the same situation. In the end I manually changed the TOC line to:

[TOC levels=2,3]: # "## Table of Contents"

which is what I wanted to achieve (heading level 1: API, heading level 2: TOC), and that works.

vsch commented 4 years ago

@InvisibleSmiley, can reproduce. It's a bug.

vsch commented 4 years ago

@InvisibleSmiley, new EAP 3.0.xxx.85 is released.

EAP update with a fix for the issue is available.

Installing EAP Plugin Version

Please note the change that EAP channel is for JetBrains licensed plugin and Legacy EAP is for legacy licensing by vladsch.com

InvisibleSmiley commented 4 years ago

"Title Level" still seems to do nothing. Changing it even disables all buttons except for Reset and Cancel.

vsch commented 4 years ago

@InvisibleSmiley, the buttons are disabled if their action results in no changes. So if the selected options result in no text change for the TOC, OK and Reset will be disabled.

Title Level options are optimized to minimize text.

Can you please post a screenshot of the dialog with the disabled buttons and the [TOC....]:... line on which it is used so I can see the selection.

InvisibleSmiley commented 4 years ago

TOC

The problem seems to be that as long as the Title reads exactly "Table of Contents", changing Title Level has no effect.

vsch commented 4 years ago

@InvisibleSmiley, sorry I confused Include Levels with Title Level and only addressed the former.

Options form for TOC settings was not updating the title level value properly.

Another EAP with a bunch of fixes is due today or tomorrow.

vsch commented 4 years ago

@InvisibleSmiley, new EAP 3.0.xxx.87 released. Should be available shortly.

EAP update with a fix for the issue is available.

Installing EAP Plugin Version

Please note the change that EAP channel is for JetBrains licensed plugin and Legacy EAP is for legacy licensing by vladsch.com

InvisibleSmiley commented 4 years ago

It is better now in the sense that Title Level is no longer ignored if Title reads "Table of Contents" or anything else that does not start with a hash.

If however the dialog is opened from a line reading

[TOC]:` # "## Table of Contents"

then the Title value will start with ## in which case changing Title Level will have no effect.

I'll leave it up to you whether you consider the bug fixed. At least the dialog is usable now. :-)

vsch commented 4 years ago

@InvisibleSmiley, this is still a bug but under different conditions.

The plugin used to have code in the markdown library handling the TOC and in the plugin, using the IDE AST. I removed the duplication. I missed a few code differences.

I do not have UI automated tests and rely on testing the underlying non-UI code. Not all conditions are caught this way. I apologize for the inconvenience. I will get this fixed.

vsch commented 4 years ago

EAP update with a fix for the issue is available.

Installing EAP Plugin Version

Please note the change that EAP channel is for JetBrains licensed plugin and Legacy EAP is for legacy licensing by vladsch.com

InvisibleSmiley commented 4 years ago

Looks good now, thanks!