question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class names with the same letters as the attribute name will fold the attribute

See original GitHub issue

image As you can see if you type “c” or “lass”, etc, will break the attribute.

I know that this is hard to fix since this is not only used for class but maybe a fix could be to have 2 regex, one for the attribute and another for the value.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
JasperSurmontcommented, Jul 16, 2022

This is not because of some regex magic, it is because of the usage of indexOf:

// src/decorator.ts

updateDecorations() {
   ...
   match[0].indexOf(matched) // --> if matched == 'class' and the attribute is also called 'class' it will take the index of the start
   ...
}

I proposed a solution in #25, although it is not the most beautiful.

1reaction
moalamricommented, Jul 18, 2022

@JasperSurmont 👍🏻 Correct 😃 Don’t you worry about the group or regex validation as if the regex isn’t applicable it will fail to apply any decoration 💯 Please check your PR, I applied your suggestion there. If all good then I can merge it 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attributes.Name (Java Platform SE 7 ) - Oracle Help Center
The Attributes.Name class represents an attribute name stored in this Map. Valid attribute names are case-insensitive, are restricted to the ASCII ...
Read more >
2 names for a same attribute - python - Stack Overflow
Python properties can have setters. So all you need is class Foo(object): @property def BA(self): return self.AB @BA.setter def BA(self, ...
Read more >
PEP 8 – Style Guide for Python Code
When applying the guideline would make the code less readable, even for ... a class attribute, invokes name mangling (inside class FooBar, ...
Read more >
RFC 2985: PKCS #9: Selected Object Classes and Attribute ...
This memo provides a selection of object classes and attribute types for use ... name The unstructuredName attribute type specifies the name or...
Read more >
Extensible Markup Language (XML) 1.0 (Fifth Edition) - W3C
Extensible Markup Language, abbreviated XML, describes a class of data ... An attribute name MUST NOT appear more than once in the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found