Skip to content

Commit

Permalink
fix: backtracking for cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Singh1 committed Jan 15, 2024
1 parent 3649a76 commit 4f6cd52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions sandbox/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as stylex from "@stylexjs/stylex";
import stylex2 from "@stylexjs/stylex";
import { createTheme as createThemee } from "@stylexjs/stylex";
import { colors, spacing } from "./tokens.stylex";
const stylex3 = require("@stylexjs/stylex");

// A constant can be used to avoid repeating the media query
const DARK = "@media (prefers-color-scheme: dark)";
Expand All @@ -19,14 +20,14 @@ export const dracula = createThemee(colors, {
lineColor: "red",
});

const styles = stylex.create({
const styles = stylex3.create({
root: {
width: "100%",
maxWidth: 800,
minHeight: 40,
},
child: {
backgroundColor: "",
backgroundColor: "red",
content: "",
marginBlock: "1rem",
},
Expand Down
6 changes: 4 additions & 2 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ let hasDiagnosticRelatedInformationCapability = false;
},

"*"(node) {
if ("span" in node) {
if ("span" in node && node.type !== "VariableDeclaration") {
const startSpanRelative = textDocument.positionAt(
byteRepresentation.byteOffsetToCharIndex(
node.span.start - moduleStart,
Expand Down Expand Up @@ -827,7 +827,7 @@ let hasDiagnosticRelatedInformationCapability = false;
},

"*"(node) {
if ("span" in node) {
if ("span" in node && node.type !== "VariableDeclaration") {
const startSpanRelative = document.positionAt(
byteRepresentation.byteOffsetToCharIndex(
node.span.start - moduleStart,
Expand Down Expand Up @@ -875,6 +875,8 @@ let hasDiagnosticRelatedInformationCapability = false;
},

VariableDeclarator(node) {
console.log(node);

handleRequires(node, stateManager, settings);
},

Expand Down

0 comments on commit 4f6cd52

Please sign in to comment.