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

(csharp) "where" keyword is not recognized as constraint #1714

Closed
superyyrrzz opened this issue Mar 22, 2018 · 5 comments · Fixed by #2378
Closed

(csharp) "where" keyword is not recognized as constraint #1714

superyyrrzz opened this issue Mar 22, 2018 · 5 comments · Fixed by #2378
Labels
bug help welcome Could use help from community

Comments

@superyyrrzz
Copy link

Here's an example:

public class TesterA<R, S>  where R : class where S : IComparable

Rendered result:
image

@KristianWedberg
Copy link

This (i.e. constraints and base class keywords should be colored as keywords) is still an issue, any chance it will be addressed?

@marcoscaceres
Copy link
Contributor

Hi @KristianWedberg or @superyyrrzz, as we have limited people maintaining the project, we rely on the community to help us with maintaining the languages themselves. Would you be willing to have a look at the language file and add "where" as a keyword if its missing? Most language files are pretty easy to change and logically organized.

@KristianWedberg
Copy link

KristianWedberg commented Mar 7, 2019

I took a quick look, and the where and class keywords are already present in the "cs.js" language file. Despite this, neither where nor class gets highlighted when used as constraints, even though class gets highlighted as part of public class.

Debugging this is a bit beyond me, any ideas what might cause this?

@marcoscaceres
Copy link
Contributor

@KristianWedberg thanks for taking a look. Not sure what might be causing it. Will leave this open in the hope someone else picks it up.

@joshgoebel
Copy link
Member

joshgoebel commented Oct 4, 2019

cs.js

      {
        beginKeywords: 'class interface', end: /[{;=]/,
        illegal: /[^\s:,]/,
        contains: [
          hljs.TITLE_MODE,
          hljs.C_LINE_COMMENT_MODE,
          hljs.C_BLOCK_COMMENT_MODE
        ]
      },

class starts a match and doesn't stop until it hits {,;, etc... and only matches title, or comments... so it won't match keywords. Someone would have to extend this matcher to also match class related keywords. At least that's what I see.

@joshgoebel joshgoebel changed the title C# "where" key work is recognized (csharp) "where" keyword is not recognized as constraint Oct 13, 2019
@joshgoebel joshgoebel added bug help welcome Could use help from community labels Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants