Closed jafeltra closed 6 months ago
Alrighty, I was tempted to say we don't care, but really I did care. I think that pattern of mismatched highlighting has actually been around for a long time, but I think I found a pretty easy way to address it. I did two things to get the highlighting to be consistent:
$
($abc
) are highlighted brown like URLs are. I thought that made sense since they represent URLs. I also made it so that the match for those ends with a space or a #
since that's where an alias ends and either a new word or a code starts. That's dca537c.#
can be part of a valid URL, which is why it had previously been in our regular expression for matching URLs. However, it seemed like it would be much more common in FSH to have a URL without a fragment and with a code. I couldn't think of a way to distinguish a URL ending with a fragment and a URL system with a code. So I decided to remove the #
from the regular expression for a URL, that way we can highlight the URL portion brown and highlight the code portion green. I think this could lead to some mildly confusing highlighting when creating an Alias with a url that has a fragment, but I decided I was okay with that. Let me know if you are also okay with that. That's ac66df9.
Fixes #72
This PR fixes the issue reported in #72. With the current version of the extension, having a coding with a system that uses an alias and a code that has spaces does not highlight correctly. With this branch, the following rule no longer breaks the syntax highlighting for the rest of the file:
I also made a bonus update to an issue that I saw recently. When using an Alias that starts with
$
after a FSH keyword, it wasn't highlighted. If this shouldn't have been highlighted, I can revert this change. With this branch, the following keyword highlight as expected:I checked and neither of these issues appear on FSH Online because it uses slightly different syntax highlighting.
I also ran an
npm audit fix
and committed those changes, and I had to update the@vscode/test-electron
dependency to get the tests to run again.