ColdFusion icon indicating copy to clipboard operation
ColdFusion copied to clipboard

Greater sign does not work in my Windows Sublime installation

Open gfranz opened this issue 12 years ago • 88 comments

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 avatar Nov 28 '12 11:11 gfranz

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 avatar Nov 28 '12 12:11 gfranz

Fixed it by installing everything again. Thanks anyway

gfranz avatar Nov 28 '12 12:11 gfranz

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.

danwatt avatar Dec 17 '12 13:12 danwatt

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.

atomi avatar Dec 17 '12 15:12 atomi

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.

danwatt avatar Dec 17 '12 17:12 danwatt

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.

atomi avatar Feb 05 '13 17:02 atomi

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

irlTopper avatar Feb 07 '13 13:02 irlTopper

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

danwatt avatar Feb 07 '13 14:02 danwatt

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.

atomi avatar Feb 07 '13 23:02 atomi

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 [email protected] 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.

irlTopper avatar Feb 10 '13 12:02 irlTopper

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

jamie-pate avatar Feb 12 '13 05:02 jamie-pate

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.

atomi avatar Feb 12 '13 08:02 atomi

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

jamie-pate avatar Feb 18 '13 04:02 jamie-pate

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

tollus avatar Feb 25 '13 18:02 tollus

Thanks @tollus I'll take a look at it

atomi avatar Feb 25 '13 18:02 atomi

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.

atomi avatar Feb 26 '13 04:02 atomi

@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

tollus avatar Feb 26 '13 13:02 tollus

@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()

atomi avatar Feb 26 '13 15:02 atomi

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()

tollus avatar Feb 26 '13 15:02 tollus

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

atomi avatar Feb 26 '13 16:02 atomi

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

tollus avatar Feb 26 '13 16:02 tollus

@tollus Your fix

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

should be fine.

atomi avatar Feb 26 '13 16:02 atomi

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

Critter avatar Jun 18 '13 18:06 Critter

@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 avatar Jun 18 '13 19:06 atomi

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

atomi avatar Jun 18 '13 19:06 atomi

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

Critter avatar Jun 18 '13 20:06 Critter

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

Critter avatar Jun 28 '13 18:06 Critter

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.

JorgenSmith avatar Jun 30 '13 09:06 JorgenSmith

@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?

misterdai avatar Jul 04 '13 10:07 misterdai

@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.

robred avatar Jul 05 '13 15:07 robred