Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Bug with JS autocompletion #12197

Closed
Tchoupinax opened this issue Feb 5, 2016 · 4 comments
Closed

Bug with JS autocompletion #12197

Tchoupinax opened this issue Feb 5, 2016 · 4 comments

Comments

@Tchoupinax
Copy link

Hello,

i found a bug about JS autocompletion on Brackets.
Let's create an html file like this :

`

<title>Home</title> <script> </script> <style> </style> `

Then, all is working right. When you write "d" between script tag, Brackets gives you some suggestion. Now, insert in body this code "<p>...</p>". You can replace p by other tag like h1, h3, etc...
After that, save your file and restart brackets (Close it and start it). Then, after restarting it, try to write again "d" between script tag. Autocompletion will not work.

While you do not restart Brackets, this code "<p>...</p>" prevent JS autocompletion from working.
IMPORTANT. If you close Brackets with this file overview, this bug will appear. However, if you close it with an other file, autocompletion will work perfectly while do not open this file in brackets.

Autocompletion works for CSS or HTML anyway.

Sorry for my bad english. If you need more information on what i did, just ask it.

Regards,

@petetnt
Copy link
Collaborator

petetnt commented Feb 5, 2016

Hi @Tchoupinax, can confirm!

Actually just .. is enough:

<html> 
    <head>
        <title>Home</title> 
    </head>
    <body>..</body> 
</html>

This will throw the following at ScopeManager#L1073

 Worker: Error thrown in tern_worker:undefined is not a function
TypeError: undefined is not a function
    at infer (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:1100:39)
    at file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:987:9
    at Object.BinaryExpression (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:906:15)
    at infer (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:1100:39)
    at file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:986:9
    at Object.BinaryExpression (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:906:15)
    at infer (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:1100:39)
    at Object.walk.make.Expression (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/tern/lib/infer.js:1105:7)
    at c (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/acorn/util/walk.js:60:37)
    at Object.base.ExpressionStatement (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/JavaScriptCodeHints/thirdparty/acorn/util/walk.js:176:5)

TernWorker will fail to walk over the .. item because it thinks it's an expression statement

I'll investigate it further.

@K-Thompson
Copy link

@petetnt

I'll investigate it further.<<

See:

Error raised in tern_worker when parsing HTML #11162

Perhaps some research has already been done?

Further, personally, code hinting and autocomplete are main reasons for using Brackets. But, I think hinting and auto complete is unreliable and these issues need to be more carefully track.

See Code Hints Unreliable #11570

Code Hints Don't work for me any longer --JS only-- #12322

@petetnt
Copy link
Collaborator

petetnt commented Mar 27, 2016

@K-Thompson have you tested the code hints against newer versions of Acorn / Tern (such as with #11569?)

@marcelgerber
Copy link
Contributor

This is fixed with the merge of #11569 and will come to you in Release 1.8.
Please let us know if it still doesn't work for you when the Release ships.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants