jcberquist / sublimetext-cfml

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

AttributeError: 'NoneType' object has no attribute 'get_mapping' #79

Closed KrunchMuffin closed 7 years ago

KrunchMuffin commented 7 years ago

I get this when doing CTRL+ALT+Left Click to go to the cfc method

Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 818, in run return self.run(edit) File "C:\Program Files\Sublime Text 3\Data\Packages\TypeScript\typescript\commands\references.py", line 35, in run mapping = ref_info.get_mapping(str(cursor[0])) AttributeError: 'NoneType' object has no attribute 'get_mapping'

jcberquist commented 7 years ago

As you can see in the traceback, the error is coming from the TypeScript plugin. It also defines a CTRL + ALT + Left Click binding: Default.sublime-mousemap

Unfortunately, as far as I can tell, mouse bindings are global in ST (unlike key bindings which can do different things in different file types) and the TypeScript plugin loads after the CFML one (alphabetical order) so its mouse binding overwrites the CFML one. With both plugins installed your only option is to put a mouse mapping file in your User package folder (which always gets loaded last). If you put this file: Default (Windows).sublime-mousemap in your User package folder, the mouse binding will work for the CFML package again (but break it for the TypeScript one). You could also edit it to use different key modifiers so that they both work.

KrunchMuffin commented 7 years ago

crap, I didn't even see that. Sorry. I don't need it so buhbye.

KrunchMuffin commented 7 years ago

ok, so I removed it, still didn't work. I went to open the CFML mouse bindings and it won't open and throws this error.

File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 795, in run return self.run(**args) TypeError: run() got an unexpected keyword argument 'contents'

jcberquist commented 7 years ago

If you removed the TypeScript plugin, you shouldn't need to edit any of the CFML package files, but you will need to restart ST to ensure the CFML mouse binding is reloaded.

KrunchMuffin commented 7 years ago

I figured as much, but since it wasn't working I wanted to see if it was in there. It is BTW. So I don't know why it isn't working. ALong with cfdump snippet. maybe others. I did restart.

On Thu, Jun 29, 2017 at 12:56 PM, jcberquist notifications@github.com wrote:

If you removed the TypeScript plugin, you shouldn't need to edit any of the CFML package files, but you will need to restart ST to ensure the CFML mouse binding is reloaded.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jcberquist/sublimetext-cfml/issues/79#issuecomment-312027787, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_TjWi-SG1OEOCJza65b_4Ah_fvl3CRks5sI9cjgaJpZM4OJY_U .

jcberquist commented 7 years ago

Right after a fresh restart could you take a look at the console and see if there are any error messages there from the loading that occurs at startup?

KrunchMuffin commented 7 years ago

No errors at all after restarting it.

On Thu, Jun 29, 2017 at 12:59 PM, jcberquist notifications@github.com wrote:

Right after a fresh restart could you take a look at the console and see if there are any error messages there from the loading that occurs at startup?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jcberquist/sublimetext-cfml/issues/79#issuecomment-312028824, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_TjUmEvrQW2ovsqQuvKFbcL9aKN4Mtks5sI9gEgaJpZM4OJY_U .

jcberquist commented 7 years ago

Do any of the key bindings for the package work? For instance, can you use F1 to pull up cfdocs.org data? If nothing works it might be worth removing and reinstalling the package. If some work and some don't something might be still be blocking certain bindings? In either case, you could try running sublime.log_commands(True) in the console and then trying some of the bindings and see what is logged to the console...

KrunchMuffin commented 7 years ago

What does not work

F1 works for CF docs, but not for CFC scoped in application console I get cfml_inline_documentation {"doc_type": "inline_doc"} ctrl+alt+ left click for console i get cfml_goto_file {"event": {"button":1, "x": 590.5, "y": 376.5}} ctrl+alt+d- for console output I get go_to_var_definition shift+# - nothing in console

jcberquist commented 7 years ago

So the CTRL+ALT+d is being overwritten by some other package or your own user key bindings - go_to_var_definition is not a command in the CFML package, or in the default package as far as I know. If the key binding was bound correctly the command you would see is insert_snippet.

I am not sure what you were expecting when typing #? Does it not output a # character? I do have a binding for that character that only applies in CFML strings and within a <cfoutput></cfoutput> block, and only when there is some text selected - in that case it will wrap the selected text in # # - otherwise it does nothing. Were you expecting different behavior?

It looks like the F1 key binding is working correctly, as well as the CTRL+ALT+Left Click binding. So that suggests to me that either the plugin is not indexing your CFC's correctly, or perhaps a mapping isn't defined correctly. I would have to know more about the situation to help more. Your sublime-project settings, if you can share them, what text you are pressing F1 on, and which CFC (its path) you expect to see documentation for would be helpful information.

KrunchMuffin commented 7 years ago

ok, I guess for the #'s I wasn't in a cfoutput. ctrl+alt+d not a big deal. But I would like to have the ctrl+alt+left click working for sure. Only other way I can do it is right clicking and going to go to definition I have tried on 2 different machines and projects.

{
"folders":
[
    {
        "path": "."
    }
],
"mappings": [
    {"mapping": "/qry", "path": "qry"}
],
"cfc_folders": [
    {
        "path": "com",
        "variable_names": ["{cfc}", "{cfc}{cfc_folder}"],
        "accessors": false
    }
]
}

I press F1 on this application.emailObj = new com.communication.email(); and this <cfset getMemo=application.messagesObj.getMessages( profileid = Val(request.args.profile_id), userlevelid = "0,1,2" )>

jcberquist commented 7 years ago

I would recommend two things - first, in the cfc_folders setting, you will need to change "variable_names" to include the Obj suffix you are using so:

"variable_names": ["{cfc}", "{cfc}{cfc_folder}", "{cfc}Obj"]

(You really only need the the first two in the list if you want it to treat those variable names as referring to components; since you are using the Obj suffix you may not want that.)

Secondly, could you add a mapping for your com folder:

{"mapping": "/com", "path": "com"}
KrunchMuffin commented 7 years ago

YES! Thank you! Thank you!

On Fri, Jun 30, 2017 at 2:18 PM, jcberquist notifications@github.com wrote:

I would recommend two things - first, in the cfc_folders setting, you will need to change "variable_names" to include the Obj suffix you are using so:

"variable_names": ["{cfc}", "{cfc}{cfc_folder}", "{cfc}Obj"]

(You really only need the the first two in the list if you want it to treat those variable names as referring to components; since you are using the Obj suffix you may not want that.)

Secondly, could you add a mapping for your com folder:

{"mapping": "/com", "path": "com"}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jcberquist/sublimetext-cfml/issues/79#issuecomment-312338482, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_TjUy2XQiYB9VEVOYlsZxhbCnYidiDks5sJTvfgaJpZM4OJY_U .

jcberquist commented 7 years ago

Great! Glad it is working now.