JavaScript macro: syntax validation message displayed on the wrong line #381

Closed
ervumlens opened this Issue Jun 29, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@ervumlens

Problem
I created a JavaScript macro that performs an assignment (not a test) in a while loop's test expression, as in while (x = doSomething()) {...}. The syntax checker detects it, but it tells me the problem is on the line before the while keyword.

The problem also occurs for me with errors and other warnings. No message is displayed if the warning or error is on line 1 of the macro.

Steps to Reproduce

  1. Open Komodo Edit.
  2. Create a new JavaScript macro.
  3. Write in the following code:
var x;
var y;
alert("I'm not the problem!");
while (x = y) {
    break;
}

`
4. Save the file for good measure.
5. Wait a few seconds for the syntax checker to do its thing.

Expected
The syntax checker produces a warning on the line containing while (x = y) {.

Actual
The syntax checker produces a warning on the line containing alert("I'm not the problem!");.

syntax warning in a JS macro

The same code produces the correct warning in a regular JS file:

syntax warning in a regular JS file

I tried my best to trick the macro into working and the regular file into breaking -- opening, closing, copying, pasting -- but didn't have any luck either way.

Komodo Edit 9.1.0 build 15798 (platform linux-x86_64, running on Linux 3.13.0-37-generic version 64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014)

@Naatan

This comment has been minimized.

Show comment
Hide comment
@Naatan

Naatan Jun 29, 2015

Member

I cannot reproduce. Could you upload the actual file so line endings/encoding is intact?

Member

Naatan commented Jun 29, 2015

I cannot reproduce. Could you upload the actual file so line endings/encoding is intact?

@ervumlens

This comment has been minimized.

Show comment
Hide comment
@ervumlens

ervumlens Jun 29, 2015

Thanks for taking a look.

Could you upload the actual file so line endings/encoding is intact?

I recreated the bug and uploaded the corresponding .komodotool file to here. Let me know if there are other files to upload. I can't think of any.

Thanks for taking a look.

Could you upload the actual file so line endings/encoding is intact?

I recreated the bug and uploaded the corresponding .komodotool file to here. Let me know if there are other files to upload. I can't think of any.

@ervumlens

This comment has been minimized.

Show comment
Hide comment
@ervumlens

ervumlens Jun 29, 2015

I'm able to reproduce this (from scratch, following the steps above) in Windows Vista.

image

I'm able to reproduce this (from scratch, following the steps above) in Windows Vista.

image

@cgchoffman

This comment has been minimized.

Show comment
Hide comment
@cgchoffman

cgchoffman Jun 29, 2015

Member

I was able to reproduce this on my Windows machine and OSX. Nathanr, not sure if you were "editing" the macro in Komodo or if you were editing it in the Macro properties dialog. The latter doesn't produce the error.

Member

cgchoffman commented Jun 29, 2015

I was able to reproduce this on my Windows machine and OSX. Nathanr, not sure if you were "editing" the macro in Komodo or if you were editing it in the Macro properties dialog. The latter doesn't produce the error.

@Naatan

This comment has been minimized.

Show comment
Hide comment
@Naatan

Naatan Jun 29, 2015

Member

My bad, I didnt create it as a macro. Able to reproduce it as well now.

I suspect this is because when you edit a macro in the main editor it creates a virtual file, which does not appear to offset the linter properly.

@mitchell-as assigning to you since this relates to Scintilla. But @cgchoffman feel free to steal, considering you've been looking at a lot of that toolbox code.

Member

Naatan commented Jun 29, 2015

My bad, I didnt create it as a macro. Able to reproduce it as well now.

I suspect this is because when you edit a macro in the main editor it creates a virtual file, which does not appear to offset the linter properly.

@mitchell-as assigning to you since this relates to Scintilla. But @cgchoffman feel free to steal, considering you've been looking at a lot of that toolbox code.

@Naatan Naatan added Type: Bug and removed Pending: Internal labels Jun 29, 2015

@Naatan Naatan modified the milestones: 9.2, 9.2.1 Jun 29, 2015

mitchell-as added a commit that referenced this issue Aug 10, 2015

lint: Fixed linting for Javascript macros - fixes #381
There is no 1-line offset when editing JS macros in the main editor.

rn=

(integrated from master branch change 9.2.1-212-g0704339 by Mitchell <mitchellb@activestate.com>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment