SublimeText / ColdFusion

ColdFusion Sublime Text Package
MIT License
198 stars 64 forks source link

Greater sign does not work in my Windows Sublime installation #106

Open gfranz opened 11 years ago

gfranz commented 11 years ago

Funnily enough in the CFML (do not use) syntax it works. Just in the ColdFusion Markup and Coldfusion Component Syntax it does not work.

HELP!

Gert

gfranz commented 11 years ago

Seems like my Key Bindings and User Bindings are empty. So I assume that has to do with it. I really wonder since syntax highlighting works and so the package must have been installed properly.

gfranz commented 11 years ago

Fixed it by installing everything again. Thanks anyway

danwatt commented 11 years ago

This exact issue happens to me periodically as well on my Mac installation. The only solution is to remove the package and re-add it.

atomi commented 11 years ago

Hey @danwatt Is there a specific region in the editor where the greater than sign isn't working, or is it just not working anywhere in the editor? Does this happen in cfscript or cfscript cfc's as well? If you open a new empty cfm file is the greater than sign still not working there either? Does copying and pasting a greater than sign work? When this happens again can you check to see if you remove the sublime-keymap files from the ColdFusion folder and restart Sublime fixes the problem.

Unfortunately I'm going to need more information since, I just haven't been able to replicate this issue. Thanks.

danwatt commented 11 years ago

I have for sure encountered this in CFMs that have CFScript blocks in them. I have not tried creating a new empty file. Copy and pasting works fine.

I will check the keymap file next time it happens, and post a gist of a file that exhibits this behavior.

atomi commented 11 years ago

If you're having problems with this please let me know the following:

Enter console (`ctrl+``) and type:

view.window().run_command('close_cftag')

it should print the character > at your cursor.

What does the console pane output when you enter

sublime.log_input(True)
sublime.log_commands(True)

and type the > character in a cfm file?

Is the > key not working in both cfc and cfm files or in just some parts of some files? If it's just some parts please post the relevant code.

irlTopper commented 11 years ago

Hi Atomi,

Just to be clear and sorry if I didn't mention this already – I am using Sublime Text 3 and the dev version.

Thanks for the reply here. Unfortunately this didn't work for me. When I run view.window().run_command('close_cftag'), nothing happens (no character prints at cursor).

After turning on the logging, I get: chr evt: > (0x3e) command: close_cftag

Both cfm and cfc files have this problem.

">" doesn't work in any part of file.

I hope that helps.

Thanks, Peter

danwatt commented 11 years ago

Typing a '>' into a CFM: chr evt: > (0x3e) command: close_cftag

view.window().run_command('close_cftag') - does nothing

Sublime 2.0.1 b 2217 Coldfusion package 2012.12.08.14.27.36

atomi commented 11 years ago

Yeah I don't know. It looks like the command close_cftag is being called but not actually running.

Are you guys getting completions?

You could try adding a print statements to various parts of the run() method in the CloseCftagCommand class to see if it prints to console.

Here is the relevant command source code for Sublime Text 2 https://github.com/SublimeText/ColdFusion/blob/master/coldfusiontagcompletions.py#L22 and Sublime Text 3 https://github.com/SublimeText/ColdFusion/blob/development/coldfusion-plugin.py#L116

If you do see your print statement being executed try to return out of the command by adding return None immediately after the code that inserts the > character.

        # insert the ">" char
        for region in self.view.sel():
            self.view.insert(edit, region.end(), ">")

The for region in self.view.sel() statement loops over a list containing the currently selected regions. The self.view.insert(edit, region.end(), ">") statement tells Sublime to insert the > character at the end of every region that is selected (which translates to the cursor position)

If you don't see your print statements being executed check the console log `ctrl+`` for any errors, if you don't see any try introducing bad code in the run() method of the CloseCftagCommand class to check if Sublime is indeed running the command. Post back any relevant console information if you can.

I've tried clean installs on both versions in both builds and they are both working for me so I'm having a really hard time figuring out what could possibly be going wrong here. I'm really sorry I can't be more helpful.

Correction: region.end() returns the greater of properties a or b of that region which doesn't necessarily translate to the cursor's position. This should be changed to region.b although inconsequential in this case as the region properties are both the same when there is no selection.

irlTopper commented 11 years ago

Thanks for all the help with this. I didn't have time to try this I'm afraid and for now, I've just gone back to SBT2. Thanks anyhow and please keep up great work.

On 7 Feb 2013, at 23:16, atomi notifications@github.com wrote:

Yeah I don't know. It looks like the command close_cftag is being called but not actually running.

Are you guys getting completions?

You could try adding a print statements to various parts of the run() method in the CloseCftagCommand class to see if it prints to console.

Here is the relevant command source code for Sublime Text 2 https://github.com/SublimeText/ColdFusion/blob/master/coldfusiontagcompletions.py#L22 and Sublime Text 3 https://github.com/SublimeText/ColdFusion/blob/development/coldfusion-plugin.py#L116

If you do see your print statement being executed try to return out of the command by adding return None immediately after the code that inserts the > character.

    # insert the ">" char
    for region in self.view.sel():
        self.view.insert(edit, region.end(), ">")

The for region in self.view.sel() statement loops over a list containing the currently selected regions. The self.view.insert(edit, region.end(), ">") statement tells Sublime to insert the > character at the end of every region that is selected (which translates to the carat position)

If you don't see your print statements being executed check the console log for any errors, if you don't see any try introducing bad code in the run() method of the CloseCftagCommand class to check if indeed it is running the command. Post back any relevant console information.

I've tried clean installs on both versions in both builds and they are both working for me so I'm having a really hard time figuring out what could possibly be going wrong here. I'm really sorry I can't be more helpful.

— Reply to this email directly or view it on GitHub.

jamie-pate commented 11 years ago

WIERD, reinstalling from git developer branch didn't fix, but touching the coldfusion-plugin.py did. (no source changes)

All i did was add and remove print statements and it works fine now.

I suspect some cache or pyc file somewhere? dunno, just happy it works for me now ;D

atomi commented 11 years ago

Thanks for the update @jamie-pate There have been a lot of API and feature changes made during this beta period of Sublime Text 3. It's great that development is continuing at this pace but some stuff is still in a state of flux. So, I'm holding off on updating this package for a little bit. Don't let that stop you guys from contributing if you feel like it. The completions stuff in development branch is actually really basic API code.

jamie-pate commented 11 years ago

ok, i think i know what it is... it's a startup timing issue, the CloseCFTagCommand class doesn't get created in time or something. If i load ST3 the > key doesn't work, but when I reload the plugin (by modifying coldfusion-plugin.py) it starts working..

I've noticed this type of issue a lot with migrating plugins to ST3

tollus commented 11 years ago

Sorry @atomi the previous error was invalid because it was cf9, here's the error I've been seeing. (I removed the previous comment)


reloading plugin ColdFusion.coldfusion-plugin
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 70, in reload_plugin
    m = importlib.import_module(modulename)
  File "X/importlib/__init__.py", line 88, in import_module
  File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 869, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Users\<user>\AppData\Roaming\Sublime Text 3\Packages\ColdFusion\coldfusion-plugin.py", line 7, in <module>
    import ColdFusion.dictionaries as dic
  File "C:\Users\<user>\AppData\Roaming\Sublime Text 3\Packages\ColdFusion\dictionaries\__init__.py", line 13, in <module>
    _init()
  File "C:\Users\<user>\AppData\Roaming\Sublime Text 3\Packages\ColdFusion\dictionaries\__init__.py", line 8, in _init
    lang = __import__(s.get('dictionary','cf10'),globals(),locals(),['*'],1)
TypeError: __import__() argument 1 must be str, not None
atomi commented 11 years ago

Thanks @tollus I'll take a look at it

atomi commented 11 years ago

Hi @tollus the API for Sublime Text 3 was changed in this most recent build to allow some API calls to populate data prior to plugin_loaded() (like settings calls and version info). This also means that the development branch of the ColdFusion plugin will need to be updated to accommodate the changes.

tollus commented 11 years ago

@atomi This code change seemed to fix the issue, though I don't know if this makes me miss something?

--- a/dictionaries/__init__.py
+++ b/dictionaries/__init__.py
@@ -9,7 +9,7 @@ def _init():

 # load dictionary selectors and completions for ST2
-if sublime.version():
+if int(sublime.version()) < 3000:
     _init()

 # load dictionary selectors and completions for ST3
atomi commented 11 years ago

@tollus Yeah that hack is there because before 3013, sublime.version() and sublime.load_settings() would always be null in ST3 so we had to wait to run _init() until after plugin_loaded()

tollus commented 11 years ago

oh okay, so maybe it's as simple as just combining those two statements for the fix?

if sublime.version() and int(sublime.version()) < 3000:
     _init()
atomi commented 11 years ago

I think if sublime.load_settings() is working in 3013 we shouldn't need _init() at all or plugin_loaded().

tollus commented 11 years ago

Ah, okay, sounds good to me. Let me know when you make the change and I can test it for you.

atomi commented 11 years ago

@tollus Your fix

if sublime.version() and int(sublime.version()) < 3000:
     _init()

should be fine.

Critter commented 11 years ago

@atomi what and where do I need to edit to fix this?

atomi commented 11 years ago

@Critter I haven't been able to reproduce this and I've been using this plugin almost daily. I would try removing the plugin and restarting Sublime then re-installing.

atomi commented 11 years ago

@Critter I'll take another look through at the close_tag command for you when I get a chance.

Critter commented 11 years ago

I'll give reinstalling a go in the meantime... Thanks.

Critter commented 11 years ago

@atomi re-installed the dev branch. and it seems to work now...

JorgenSmith commented 11 years ago

If anyone's having this issue with ST3 public beta (I just set this up on my home Win8-64 workstation fresh, having only used ST2 here before), I just installed the ColdFusion package through package control more out of habit than anything and got the same problem.

Removing the package then installing it properly through GIT as per the provided instructions on https://github.com/SublimeText/ColdFusion did the trick.

misterdai commented 11 years ago

@JorgenSmith Thanks for the tip, I was suffering with the problem on the new public beta V3 of Sublime. Followed the installation instructions instead of using the package manager and my greater than key is alive again.

I'm guessing that when the development branch code is merged with master next, the version Package Manager picks up will be functional?

robred commented 11 years ago

@JorgenSmith -- This worked for me as well. Thanks! I had stopped using ST3 for ColdFusion work because I couldn't seem to get this to work.

timmeade commented 11 years ago

Just FYI I hit what appears to be this exact issue on beta 3 and the dev code installed about a week ago on OS X. I had installed from git as instructions said.

I reinstalled package and everything works now.

MattGeri commented 11 years ago

I'm using SublimeText 3 build 3047 and installed the Coldfusion plugin through Package Control and directly by checking out the Git repo and on both installs I can't use the > sign.

Trying some of the suggestions above to get it to work, will report back.

kbouas commented 11 years ago

Same issue, SublimeText 3 build 3047, installed via Package Control & via Git. I couldn't type a > in any part of a ColdFusion file. Tried installing via Git and then switching to the development branch and that fixed my issue.

ghost commented 11 years ago

I've tried to reinstall the package from GIT several times (and switching to the development branch). The greater sign worked for one day after the first reinstallation, then it again fails to work. I've tried it several times now with no luck. Anything else I could do? Is there anything else I could try? (environment: Windows7, 64bit)

jamie-pate commented 11 years ago

You might make sure that you have removed it from package control as well. Also check Installed Packages dir for a package there..

timmeade commented 11 years ago

Removed it from pkg download. Reinstalled node from homebrew and It’s working now.

Using node’s pkg to install puts it in as root. As non root sublime can’t find it…..

Might have been easier fix, but this one is solid. Had to remove macports to install home brew.

Thanks

Tim

From: jamie-pate [mailto:notifications@github.com] Sent: Monday, August 12, 2013 9:10 PM To: SublimeText/ColdFusion Cc: Tim Meade Subject: Re: [ColdFusion] Greater sign does not work in my Windows Sublime installation (#106)

You might make sure that you have removed it from package control as well. Also check Installed Packages dir for a package there..

— Reply to this email directly or view it on GitHubhttps://github.com/SublimeText/ColdFusion/issues/106#issuecomment-22537305.

jfrux commented 11 years ago

Same issue on MAC OS X. ST2 v2.0.2 Build 2221

igal-getrailo commented 11 years ago

this started happening to me after updating the plugin to the latest version. I'm on ST2 and it worked fine for a long time until today. I updated the plugin last night.

removing the package, and installing back did not fix the problem.

igal-getrailo commented 11 years ago

any ideas how to fix this for ST 2.0.2 b2221 ?

I'm not sure why this ticket is closed as the problem still persist. thank you.

timmeade commented 11 years ago

I did either a delete and re clone of the source or just a new pull. Not sure which. So far that's fixed it twice.

jimpriest commented 11 years ago

I think this issue only occurs with Sublime Text 3. That's the only time I've run into it.

I'm using 2.0.2 2221 with no issues. With v2 you can install from Package Control.

timmeade commented 11 years ago

I certainly have had it happen on 2. I may have been running the development branch though.

igal-getrailo commented 11 years ago

@TimMeade -- I tried to update/uninstall/reinstall via package manager and that didn't help. are you doing a "manual" install?

igal-getrailo commented 11 years ago

@jimpriest -- I'm definitely experiencing this on ST 2.0.2 b2221

a couple of nights ago I used Package Control Upgrade and it installed an update, and the problem started since.

timmeade commented 11 years ago

Yes git clone from terminal.

justinwhall commented 11 years ago

Tried everything above and still nor working on mac osx. Doesn't work in ST2 either.

igal-getrailo commented 11 years ago

for some reason after restarting the server it works fine now.

gozargozarian commented 11 years ago

Experiencing this too. This has made the plugin unusable. I basically have to copy and paste the '>' symbol to close a tag. Can we get an update on this issue?

I am on ST3 3047, Windows 7 Typing a '>' into a CFM using the debug console code supplied above: chr evt: > (0x3e) command: close_cftag

view.window().run_command('close_cftag') prints a blank line.

Uninstalling, clearing my settings, and re-installing did nothing to fix it.

atomi commented 11 years ago

@gozargozarian ST3 requires installing the development branch. Some more work is needed before we can merge the deveopment branch into master as I want development branch code to work with ST2 as well.

I've also updated the close_cftag command (in development) -hopefully this improves it's function. There is also a new close/fold all functions key binding in development thanks to @tkelley

cherdt commented 11 years ago

Same thing happened to me on ST3 (Build 3047) on Win7.

As @atomi advised I went to the git repo in the Packages/ColdFusion directory and checked out the development branch: git checkout development

I could then type the greater-than symbol.