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

Fix/issue 3972 #3989

Merged
merged 8 commits into from
Feb 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issue #3972
akhtarmdsaad committed Feb 18, 2024
commit 77434cef0ed81e1ea6948763a26f36de3c6294c4
21 changes: 0 additions & 21 deletions run.html

This file was deleted.

12 changes: 10 additions & 2 deletions src/languages/typescript.js
Original file line number Diff line number Diff line change
@@ -28,10 +28,18 @@ export default function(hljs) {
"unknown"
];
const NAMESPACE = {
beginKeywords: 'namespace',
begin: [
/namespace/,
/\s+/,
hljs.IDENT_RE
],
beginScope: {
1: "keyword",
3: "variable"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the examples (https://www.typescriptlang.org/docs/handbook/namespaces.html) it looks like namespaces are class-like and CamelCase in their naming... so I think title.class would be more appropriate here than variable.

},
end: /\{/,
excludeEnd: true,
contains: [ tsLanguage.exports.CLASS_REFERENCE ]
contains: [tsLanguage.exports.CLASS_REFERENCE]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need any of this anymore - the match rule should be enough to highlight the keyword and namespace name... but should IDENT_RE used above to recognize namespace perhaps be CLASS_REFERENCE[:match] instead - if the same names rules apply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const NAMESPACE = {
    begin: [
      /namespace/,
      /\s+/,
      hljs.IDENT_RE
    ],
    beginScope: {
      1: "keyword",
      3: "title.class"
    }
  };

Is the above change enough or i should change something else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was suggesting tsLanguage.exports.CLASS_REFERENCE instead of IDENT_RE... but yes that's looking good.

};
const INTERFACE = {
beginKeywords: 'interface',