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

(swift) @objcMembers not completely highlighted #2543

Merged
merged 3 commits into from May 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -32,12 +32,14 @@ Language Improvements:
- fix(javascript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
- fix(typescript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
- fix(yaml) Fix tags to include non-word characters (#2486) [Peter Plantinga][]
- fix(swift) `@objcMembers` was being partially highlighted (#2543) [Nick Randall][]

[Josh Goebel]: https://github.com/yyyc514
[Peter Plantinga]: https://github.com/pplantinga
[David Benjamin]: https://github.com/davidben
[Vania Kucher]: https://github.com/qWici
[Hankun Lin]: https://github.com/Linhk1606
[Nick Randall]: https://github.com/nicked


## Version 10.0.2
Expand Down
2 changes: 1 addition & 1 deletion src/languages/swift.js
Expand Up @@ -125,7 +125,7 @@ export default function(hljs) {
{
className: 'meta', // @attributes
begin: '(@discardableResult|@warn_unused_result|@exported|@lazy|@noescape|' +
'@NSCopying|@NSManaged|@objc|@objcMembers|@convention|@required|' +
'@NSCopying|@NSManaged|@objcMembers|@objc|@convention|@required|' +
Copy link
Member

Choose a reason for hiding this comment

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

How are these used in code? Should we perhaps just add a \b before and after?

Copy link
Member

Choose a reason for hiding this comment

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

Or at least after? IE, this looks like the kind of thing that would keep coming up every time they added a new keyword that started with @objc, or same for any of the other keywords...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know enough about how this matching works, but if it's a standard regex, then looking for a non-word char would be better. I'd suggest \W though, because we're only looking for anything that isn't a continuation of the word

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah you're right, a trailing \b works best, don't want to include the extra matched char. Thanks

'@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|' +
'@infix|@prefix|@postfix|@autoclosure|@testable|@available|' +
'@nonobjc|@NSApplicationMain|@UIApplicationMain|@dynamicMemberLookup|' +
Expand Down