Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.14k stars 299 forks source link

Javascript autocomplete bug for try inside a string #3899

Closed KnowZero closed 3 years ago

KnowZero commented 3 years ago

Short Summary

The autocomplete for javascript is treating strings as code. Typing try inside a string leads to it autofilling the try function.

Steps to Reproduce

For a javascript file type:

console.log("try")

and than add a space at the end of try.

Expected results

It should be: console.log("try ")

Actual results

You get this:

console.log("try {

} catch(e) {
    alert(e);
}")

Platform Information

Komodo Edit or IDE? IDE Komodo Version? 12 Operating System (and version)? Linux Mint 19.3

Additional Information

Edit: The same happens if I do "if"

console.log("if (test) {
    //code
}")
KnowZero commented 3 years ago

This seems to be related to #3892 , but that one is for comments. This is for strings.

So seems like the underlying issue is the autocomplete isn't context aware.

th3coop commented 3 years ago

Yeah, this can be handled in #3892 but it should be added to the ticket. I'll do that. Going to close this ticket in favour of that.