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

Colorize SQL colors code incorrectly if there's any multi-line comment which is opened and closed in the same line #634

Closed
rdomene opened this issue Sep 28, 2022 · 3 comments · Fixed by #639
Assignees
Labels
bug Something isn't working released Available in a released installer

Comments

@rdomene
Copy link

rdomene commented Sep 28, 2022

Describe the bug
Colorize SQL colors incorrectly when there are multi-line comments that are opened and closed in the same line. It colorizes as a comment all the lines between the first "/" string and the last "/" string that does not have another "/*" in the same line.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any page.
  2. Paste the following SQL code:
SELECT
	GETDATE() AS [Today],
	/* This is a multi-line comment that starts and ends in the same line */
	(GETDATE() + 1) AS [Tomorrow],
	CAST(1 as bit) AS [Boolean],
	/*This is another multi-line comment that starts and ends in the same line */
	CAST(1 as int) AS [Number]
GO

/*
** SQL 2
*/

SELECT
	GETDATE() AS [Today],
	/* This is a multi-line comment that starts and ends in the same line */
	(GETDATE() + 1) AS [Tomorrow],
	CAST(1 as bit) AS [Boolean],
	/*
	This is a multi-line comment that starts and ends in different lines
	*/
	CAST(1 as int) AS [Number]
GO
  1. Select all the code.
  2. Click on More > Colorize > SQL
  3. Color pattern is incorrect as some non-comment lines are colorized as comments.

Expected behavior

Right color pattern should be similar to this one:

right-sql-colors

Obtained color pattern is this one:

wrong-sql-colors

Environment (if applicable):

  • Microsoft® OneNote® 2016 MSO (version 2208 compilation 16.0.15601.20148) - 64 bits
  • OneMore Version 5.1.0
@rdomene rdomene added bug Something isn't working unread I have seen it or had time to refine it yet labels Sep 28, 2022
@stevencohn stevencohn removed the unread I have seen it or had time to refine it yet label Sep 28, 2022
@stevencohn
Copy link
Owner

This should be fixed in 5.1.0 and in fact, I cannot reproduce this given the text that you provided.

@stevencohn stevencohn added the no-repro Cannot reproduce label Sep 28, 2022
@rdomene
Copy link
Author

rdomene commented Sep 29, 2022

Interesting.

I uninstalled and reinstalled OneMore, just in case.

Then I copied and pasted the SQL code I pasted as a sample. Just Copy & Paste. I selected the text, then clicked Colorize > SQL, and the text was properly colored.

colorize-sql-1

But... after that, I copied the code and pasted it with the Paste Special > Paste Keep Text Only option (this is the method I use most of the time), and then I select the text, click Colorize > SQL, then the coloring pattern is incorrect.

colorize-sql-3

colorize-sql-2

@stevencohn stevencohn removed the no-repro Cannot reproduce label Sep 29, 2022
@stevencohn
Copy link
Owner

That's helpful. Thanks. Looking into it

@stevencohn stevencohn linked a pull request Sep 29, 2022 that will close this issue
@stevencohn stevencohn added the next-release Addressed but not yet released label Sep 29, 2022
@stevencohn stevencohn self-assigned this Sep 29, 2022
@stevencohn stevencohn added released Available in a released installer and removed next-release Addressed but not yet released labels Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in a released installer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants