oleg-shilo / codemap.vscode

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

Custom mapper for multiple file extensions #37

Closed adamerose closed 4 years ago

adamerose commented 4 years ago

Can I define a custom mapper that applies to all file extensions? Or even better, be able define the file extension it should apply to with regex?

oleg-shilo commented 4 years ago

...custom mapper that applies to all file extensions...

Not exactly but you can map all extensions you come up with to a single mapper:

"codemap.ext1": "config:codemap.ext",
"codemap.ext2": "config:codemap.ext",
"codemap.ext3": "config:codemap.ext",
"codemap.ext": [
  {
      <your universal mapper>
 }
]

...the file extension it should apply to with regex?

Not at the moment. The mapper lookup algorithm is going i n a different direction extension -> mapper, not the opposite way. Thus it will need to be reversed to "mapper -> extension" to allow matching file extensions. Doable but basically the lookup will need to be redesigned. Thus it has to be a good reason ofr that.