Closed gruskada closed 7 years ago
Your setup looks correct to me. Could you try looking in the Sublime Text console to see if there are any errors? Also, when this is properly indexing custom tag files you should see the following lines in your console output:
CFML: indexing custom tags in project '/path/to/project_file.sublime-project'
CFML: indexing custom tags in project '/path/to/project_file.sublime-project' completed - x files indexed in y seconds
Got it working, thanks to the console info. Thank you!
FYI, it was complaining about an old custom tag we no longer use, so I just deleted it. That file didn't have cfparams to help define the attributes - not sure if that matters or not. Also, it complained about the encoding:
CFML: indexing custom tags in project 'C:/cfmx/trunk/Website.sublime-project'
CFML: unable to read file - c:/cfmx/customtags/test.cfm
Traceback (most recent call last):
File "src.custom_tags.custom_tags in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 43, in index_project
File "src.custom_tags.custom_tags in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 101, in generate_tag_map
KeyError: 'tag_name'
Package Control: No updated packages
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 480, in on_post_save_async
callback.on_post_save_async(v)
File "cfml_plugin in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 20, in on_post_save_async
File "src.events in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 13, in trigger
File "src.project_index in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 59, in on_post_save_async
File "src.utils in C:\Users\DAVEG\AppData\Roaming\Sublime Text 3\Installed Packages\CFML.sublime-package", line 30, in get_project_name
AttributeError: 'NoneType' object has no attribute 'project_file_name'
unable to auto detect encoding for C:\cfmx\CustomTags\test.cfm, using fallback encoding Western (Windows 1252)
I can send you the file offline if you need it to troubleshoot.
Thanks again for the help. This will be very useful feature.
Dave
Glad you got it working. Thanks for sharing your console output. It looks to me like there are a number of errors there. The significant one for this issue is that the file read on the custom tag file (that you ended up removing) failed. I don't gracefully handle that as I should, so, though I catch the read error and output the console message you see:
CFML: unable to read file - c:/cfmx/customtags/test.cfm
it is then followed immediately by the key error (tag_name
). That is why none of the tags were showing up. I will get that fixed so it doesn't cause a total failure when a single file can't be read.
There must be a character (or characters) in the file that can't be read by Python when specifying utf-8
encoding for the file read (see here). I think the message at the bottom of the console confirms this, as it is a ST message saying that it can't figure out the encoding in that same file so it is falling back to your Windows system default. I am not sure about trying to sort out why Python can't read it, since I don't really want to get more complex in the file reads than specifying utf-8
. So I think my focus will be on ensuring the read failure is logged, and that it doesn't cause a total failure.
There is also another error in your log, that I was already aware of, but haven't gotten around to fixing. When files in indexed folders are saved I re-index them. I do it in an async thread, so as to not affect the ST UI. That typically works great, except for the particular situation where you close a file that has edits and ST asks if you want to save before closing. If you select yes, by the time the on save callback is invoked, the file is closed and the file information is lost. That results in the error you see:
AttributeError: 'NoneType' object has no attribute 'project_file_name'
I am still thinking about that one, so thanks for reminding me :)
For the time being, if a file is saved and closed, a warning will be printed to the console, and no error thrown.
I edited the project file with the following:
and then added the following code to a .cfm page:
After I type the ":", I get a list of all the built-in CF tags only. I tried using a relative path, and restarting, with no luck.
Do I need to do anything else to set this up?
Thanks.