Nasller / CodeGlancePro

Minimap run on jetbrains platform.
Apache License 2.0
201 stars 22 forks source link

feature request: support markers outside of comments #115

Closed KrekkieD closed 7 months ago

KrekkieD commented 9 months ago

Hi,

I would really like it if the Markers regex would also be able to highlight things that are not code comments.

For example: I work with angular and some of my HTML files have elements that point to a different element elsewhere in the file:

<div>
  ...stuff
  <ng-container *ngTemplateOutlet="example"></ng-container>
  ...stuff
</div>

  ...stuff

<ng-template #example>
  <div>
    ...stuff
  </div>
</ng-template>

In this case it would be very helpful for me if I could add <ng-template # to the Markers regex so that the templates within the file show up in the minimap. Currently this only seems to work when I comment it out.

Nasller commented 9 months ago

The mark tag is obtained by parsing the syntax tree and obtaining comments for marking. If any text matches the Marks regex, there may be performance issues

KrekkieD commented 8 months ago

do you think there'd be an easy enough way of maintaining performance but still allowing something like this? Or maybe leave it up to the user with a checkbox (i.e. [x] also search outside of comments (might impact performance)), to decide if they want markers to run on all code instead of just on comments?

I don't know if a performance hit would be a guarantee, or if it would be more of a hypothetical problem that occurs on (primarily) excessively large files. You'd know better :)

Nasller commented 8 months ago

it parsing principle is to use the IDE's psi model to achieve text highlighting, and then I can obtain this highlight value to achieve minimap highlighting. So theoretically, I can highlight everything that is parsed by the psi model, but the psi model does not parse based on the beginning of a line see this code

Nasller commented 8 months ago

My guess is that this may be possible by finding the element type for <tag>, but this implementation is too customized, and it is limited to the XML language only

KrekkieD commented 8 months ago

okay, I understand the complexity. I also can't think of a way to easily handle this (aside from running regexes on the raw code). I'll have to stick with the code comments. Thanks for looking into it, though!