Closed Bug 2096872 Opened 2 days ago Closed 1 day ago

Syntax highlighting for javascript file looks off when opening stylesheets before

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 2083536

People

(Reporter: ochameau, Unassigned)

Details

STR

  • open http://techno-barje.fr/
  • with stylesheets enabled, open document.css in the debugger => the css syntax highlighting looks correct
  • now, open loader.js => the syntax highlighting is wrong, may be using css one?

If you open loader.js right away, on debugger opening, the syntax highlighting is correct.

setText() in Editor/index.js calls editor.setMode(SourceEditor.modes.css) for stylesheets but never switches back for other sources. The single shared editor from create-editor.js therefore keeps the CSS language compartment for every source opened after a stylesheet. This regressed in bug 2011550.

Fix: Always call setMode() with selectedSource.isStyleSheet ? modes.css : modes.javascript, and extend browser_dbg-stylesheets.js to select a .css source and then a .js source, asserting getEditorFileMode(dbg) after each.

Suggested severity: S3. Every JS source opened after a stylesheet gets the wrong highlighting until the toolbox is reopened, which hurts readability but does not stop debugging.


If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.

Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.

Severity: -- → S3
Priority: -- → P2

This is going to be fixed by Bug 2083536

Status: NEW → RESOLVED
Closed: 1 day ago
Duplicate of bug: 2083536
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.