Skip to content

[REGRESSION] incorrect syntax highlighting while switching language type #16271

@RobertOnGit

Description

@RobertOnGit

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

In Notepad++ v8.7.8 the follow problem occurs, which still worked with v8.7.6 (I'm not sure about 8v.7.7).

When selecting Language > JavaScript via the menu the automatic language detection for syntax highting should be overruled to JavaScript. However, if I open a .cmd file (with a batch zone and a jscript zone) the syntax highlight ends up somewhere in between Batch and JavaScript.
E.g. JavaScript comments don't become green and reserved word "set" in .bat/.cmd is still colored.

When opening the file the Bath syntax highlighting colors are used; when changing the language some weird deviating colors are use, but it clearly is still the Batch syntax highlighting. If I rename the file, adding the .js extension, then proper JavaScript syntax highlighing and colors are used.

Until recently this worked correctly, thus a regression.

Steps To Reproduce

  1. rename some existing .js file
  2. open it in NPP
  3. choose Language > JavaScript via the menu

Current Behavior

wrong syntax highlighting

Expected Behavior

should use the select syntax

Debug Information

Notepad++ v8.7.8   (64-bit)
Build time : Mar  7 2025 - 20:39:25
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\tst\MyEmbScript.cmd"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
Scintilla Rendering Mode : SC_TECHNOLOGY_DEFAULT (0)
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 24H2
OS Build : 26100.3323
Current ANSI codepage : 1252
Plugins : 
    ComparePlugin (2.0.2)
    CSScriptNpp (2.0.9)
    DSpellCheck (1.5)
    ExtSettings (1.3.1)
    JSMinNPP (1.2312)
    JsonTools (8.3.1)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
    NPPJSONViewer (2.1.1)
    NppMarkdownPanel (0.7.3)
    XMLTools (3.1.1.13)
    zoomdisabler_x64 (1.2)

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions