Skip to content
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

SQL Language Option - Apostrophe ' in Square Brackets [] not escaped #13160

Closed
KeithHenselNOV opened this issue Feb 17, 2023 · 4 comments
Closed
Labels
language-support Issues or PRs related to programming languages (also e.g. in styles, themes)

Comments

@KeithHenselNOV
Copy link

Description of the Issue

Apostrophes are not escaped in square brackets, resulting in the syntax highlighting for .sql files breaking.

Steps to Reproduce the Issue

The below code adds a column with an apostrophe in the name.
--alter table Default_Test_Table add [bad_column'] nvarchar NULL
update Default_Test_Table set [bad_column'] = 'asdf'
update Default_Test_Table set [bad_column''] = 'asdf'

Expected Behavior

In other editors like SSMS (tested with SQL Server Management Studio 19), this code will have the proper syntax highlighting, and the second line will execute correctly.

Actual Behavior

Notepad++ doesn't escape the ', resulting in syntax highlighting breaking after that point in the file (in the above example, the third line will display incorrectly).

Debug Information

Notepad++ v8.4.9 (64-bit)
Build time : Jan 27 2023 - 03:11:16
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:[REDACTED].sql"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 21H2
OS Build : 19044.2604
Current ANSI codepage : 1252
Plugins :
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)

First screenshot is Notepad++ (third line not displaying correctly)
NPP_01

Second is SSMS (displaying correctly)
NPP_02

@rdipardo
Copy link
Contributor

tested with SQL Server Management Studio 19

Notepad++ does not have built-in support for Transact-SQL: #12610 (comment)

In the meantime there's a UDL (for MS SQL Server 2008) that may be more suitable.

@ArkadiuszMichalski
Copy link
Contributor

SciTE for SQL display this correctly, but not for MS SQL.

@rdipardo
Copy link
Contributor

@ArkadiuszMichalski,

SciTE for SQL display this correctly, but not for MS SQL.

Here is what SciTE does with the OP's query when the MS SQL lexer is enabled (*1):

scite-mssql

Now watch as I select "ordinary" SQL from the lexer menu:

scite-sql


(*1) Extract this archive, start SciTE, and open the *.tsql file: issue-13160.zip
The custom SciTE.properties will override any existing file mapping as long as it's in the same directory as the SQL script.

@ArkadiuszMichalski
Copy link
Contributor

Right, looks like I test something in past and don't delete additional file mssql.properties.

Maybe Notepad++ should support MS SQL and MySQL language because we have such lexers.

@ArkadiuszMichalski ArkadiuszMichalski added the language-support Issues or PRs related to programming languages (also e.g. in styles, themes) label Feb 19, 2023
@donho donho closed this as completed in 01bbebf Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-support Issues or PRs related to programming languages (also e.g. in styles, themes)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants