jcberquist / sublimetext-cfml

CFML (ColdFusion and Lucee) package for Sublime Text
MIT License
115 stars 24 forks source link

CFComponent freezing up Sublime Text #97

Closed travpeck closed 6 years ago

travpeck commented 6 years ago

I have a CFComponent (in the tag syntax) that is around 500 lines of codes and contains multiple methods that run and return CFQuery results. I can't edit the component with this plugin enabled -- it keeps freezing up. I think maybe the SQL highlighting might be causing the issue (but that is just a guess).

When using VS Code, I have a CFML extension installed and it doesn't cause the above locking/freezing.

jcberquist commented 6 years ago

I am afraid that without more information there is not much I can do. Can you share the source file? Or perhaps try to narrow the problem down in the file to a smaller example that can be shared?

If it is indeed the syntax highlighting that is at fault, the highlighting engines in ST and VS Code are very different, so it doesn't surprise me that it works in one and not the other.

ghedwards commented 6 years ago

Something in this commit is causing issues for me as well.. I've forked the project and rolled back to a previous version to fix it. https://github.com/jcberquist/sublimetext-cfml/commit/b48e00569dbc15ac33b6cb59740948eef83fa36f

vm-jade commented 6 years ago

I'm experiencing some freezing/hesitation in larger CFCs. With the attached CFC (also in an actual CFC which I can't share), typing alpha characters anywhere inside the tag will cause some lag/stutter. Typing numbers seems to be fine.

ST 3 b3143, macOS High Sierra 10.13.1 (17B48)

sublime_cfml_test.txt

Hope this helps!

ghedwards commented 6 years ago

My mistake, this only worked because it failed to execute the entire completions.py script. self.view.hide_popup() inside the CfmlUpdateCompletionDocCommand class ( completions.py ) is causing the lock ups for me. If I comment out that line things work fine.

jcberquist commented 6 years ago

@vm-jade: that is helpful, thanks! I am guessing that everyone is experiencing this in tag based components?

I think I know what is going on, and I should be able to improve the situation. It involves some of the code I added recently to try and prevent false positives when indexing components (e.g. don't include commented out functions). I suspect that slows things down enough that in a large tag based file it causes the lag people are experiencing. I could probably improve that code a bit, but for files that are open in the editor it is actually not needed, since the ST syntax highlighting already ensures no invalid functions are included in the indexing. So I think I can just remove it for that case, and then performance should return to where it was before.

@ghedwards: I think what is happening when you comment out that line is that the file becomes invalid, and so the completions essentially get disabled - which would remove the issue with the lagging. To confirm you might look in the ST console to see if any errors are printed there.

ghedwards commented 6 years ago

Hi @jcberquist , could you perhaps add a setting to allow us to turn of the function indexing ?

Commenting the calls to find_script_functions and find_tag_functions seems to work ok for me at the moment.

travpeck commented 6 years ago

@vm-jade, your example freezes for me as well.

@jcberquist, Here's an example with only one method inside a CFComponent. Sublime Text starts to lock up when I copy/paste the method a couple of times.

<cfcomponent>

    <cffunction name="test" access="public" output="false" returntype="query" returnFormat="json">

        <cfargument name="customer" required="false" type="string">

        <cfquery name="test_query" datasource="test">
            SELECT Customers.CustomerName, Orders.OrderID
            FROM Customers
            LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
            ORDER BY Customers.CustomerName;
        </cfquery>

        <cfreturn test_query>

    </cffunction>

</cfcomponent>
jcberquist commented 6 years ago

@tpck: Thanks for the update - when you say copy/paste a couple of times do you mean literally two times? Based on my investigation so far, the size of the file (specifically the number of function and argument tags) should increase the amount of lag, so I would like to know at what point you start to notice the lag.

For example, on my machine, using the example file provided by @vm-jade, I am getting a delay of about 300ms or so. But on a smaller file (e.g. your code above, copy pasted a couple of times), I get a delay of only 1-2ms.

travpeck commented 6 years ago

@jcberquist: I copy/pasted it 10 times and it started to freeze/lock up when I stopped and went back to delete some white-space created from the copy/paste (hitting delete in front of a CFFunction to remove a tab).

At work I have a CFC with only 4 methods, but with SQL containing various if statements inside of CFQuery tags... that is barely usable with the plugin enabled. So I'm not sure if it is the amount of methods that is the issue.

I also have in the settings "_cfml_auto_insert_closingtag" set to true... I'm not sure if that has any impact on the above.

jcberquist commented 6 years ago

@tpck: ok, good to know. This isn't sounding to me like the same issue that I see with the example provided by @vm-jade. I can reproduce that one, it pertains to providing completions to ST, and I definitely introduced it in the last update to the plugin.

But yours sounds different. If ST freezes when you are deleting, then that doesn't sound like an issue related to the plugin providing completions. I am also currently unable to reproduce your example (copy/pasting the function 10 times doesn't cause issues locally).

Is this an issue that started for you after the plugin updated from v0.25.2 to v0.26.0? Is it possible another ST plugin is causing issues? Do you have something like Emmet installed, or something for SQL? Have you looked at the ST console to see if there are any error messages printed there? (Sorry for the string of questions, just trying to figure out what is going on.)

jcberquist commented 6 years ago

@vm-jade, @ghedwards - I have pushed an update out (v0.26.1) that should fix the issue with freezing in large tag components.

travpeck commented 6 years ago

@jcberquist, I think I've found the issue. The only time it locks up and freezes is when I use my company laptop at home (which goes through a VPN). There is no freezing when I use my personal laptop at home, or when I use my work laptop at work.

The VPN I am using for work can be really slow when it comes to dealing with network drives. Is there an option within this plugin to turn off whatever it is doing behind the scenes with the directories that I have my files stored on?

jcberquist commented 6 years ago

@tpck: Good to know - that does sound like the issue.

By default, this plugin does not crawl directories at all - you have to configure it to do so by specifying cfc folders in a sublime-project file . So it shouldn't be the source of the issue.

I do think ST has had issues with VPNs and network share mounts so it seems very likely to me that you have identified the source of the issue - but it is one ST itself has, and not any plugin specifically. (If you search the ST forum for VPN and network share issues, you will see plenty of threads on these topics.)