Skip to content

Initial JSX support for class attributes added #49

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

Merged
merged 4 commits into from
Nov 29, 2018

Conversation

RayMcCl
Copy link

@RayMcCl RayMcCl commented Nov 27, 2018

The below set of changes adds simple support for JSX peek through the same mechanism that is already present. This is related to the below issue:

#3

@@ -44,6 +44,12 @@ export default function findSelector(document: TextDocument, position: Position)
break;
case TokenType.AttributeName:
attribute = htmlScanner.getTokenText().toLowerCase();

// Convert the attribute to a standard class attribute
if (attribute === 'classname') {
Copy link
Owner

Choose a reason for hiding this comment

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

does this work with className (i.e. camelcased)?

Copy link
Author

Choose a reason for hiding this comment

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

In my test cases I had the JSX instance written as "className" and it was converted to "classname" by the scanner.

@pranaygp
Copy link
Owner

Can we add test files (a .js and .jsx) that have one of the test classes and/or ids here https://github.com/pranaygp/vscode-css-peek/tree/master/client/test/test_files. You can see the .html files making references to the classes and ids listed in the .css and .scss files.

These files aren't tested by the test suite (yet). They just exist so you can test the extension's behaviour manually.

@RayMcCl
Copy link
Author

RayMcCl commented Nov 28, 2018

JS and JSX files have been added which follow the same structure as the existing HTML test.

@pranaygp
Copy link
Owner

@ReiMcCl seems like you're not using className in any of the examples. Could you update atleast one of them to use className and then we can ship this 👌

@RayMcCl
Copy link
Author

RayMcCl commented Nov 28, 2018

Added className to the example js and jsx file 👍

@pranaygp
Copy link
Owner

Thanks!

@pranaygp pranaygp merged commit 511dd91 into pranaygp:master Nov 29, 2018
@pranaygp
Copy link
Owner

Shipped in version 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants