brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] SQL Comment Syntax Highlighting Not Working Properly #10567

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by benzen217 Thursday Mar 24, 2016 at 15:53 GMT Originally opened as https://github.com/adobe/brackets/issues/12324


Problem: A space is required after the SQL comment code "--" in order for the line to become a comment.

-- This Comment Works --This Comment does not work

Expected Outcome: anything in a line after 2 dashes ("--") should be a comment.

Current Behavior: Here is a screenshot of behavior in Brackets, all lines should be commented after the first "--"

screenshot_1

Possible Solution: I noticed in the languages.json that sql does not have a "lineComment" specified.

Inserting the following line at line 222 of the file languates.json may fix the issue. "lineComment": ["--"]

Version Info: I am running Windows 7 x64, Brackets Release 1.6 build 1.6.0-16680, Extensions Disabled

core-ai-bot commented 3 years ago

Comment by ficristo Friday Mar 25, 2016 at 13:28 GMT


Hi@benzen217, I looked a bit at this issue. Brackets at the moment is mapping sql to the mysql dialect and here it states you need a space after the two dash for mysql. So what you see it is somewhat correct. I tried changing languates.json but I guess the syntax highlighting come completely from codemirror. Here you can try several sql dialects. Finally I tried to modify languates.json to something like the following to differentiate from sql and mysql:

    "sql": {
        "name": "SQL",
        "mode": ["sql", "text/x-sql"],
        "fileExtensions": ["sql"]
    },

    "mysql": {
        "name": "MySQL",
        "mode": ["sql", "text/x-mysql"],
    },

I will not open a PR so feel free to steal the code. I'm not sure it is exact but seems to work.

core-ai-bot commented 3 years ago

Comment by benzen217 Friday Mar 25, 2016 at 14:26 GMT


Interesting, never realized that it's supposed to have a space afterwards. Oracle says the same thing

It's odd because both Oracle SQL Developer and MS SQL Server Management Studio both consider a comment to start with "--" not "-- ". Weird. Oh well.

Thanks for looking into it ficristo!

core-ai-bot commented 3 years ago

Comment by tobibeer Monday May 30, 2016 at 14:05 GMT


Why did you close this@benzen217? I'm still unable to have comments properly highlighted, even with a .languages.json file in the repo.

core-ai-bot commented 3 years ago

Comment by tobibeer Thursday Oct 20, 2016 at 11:46 GMT


@benzen217, please reopen. It's quite untenable that in SELECT 1--foo the bit that reads --foo is not shown as a comment. I don't know how this can be resolved but the issue remains.