keymap / live templates issue

hi there,

i can't seem to get some shortcuts and live templates to work in Intellij Idea 12 and wonder if it's down to the keymap.

i'm accessing Idea over a windows terminal services connection and have the following issues :

the Comment with Block Comment command doesn't do anything if I select it from the Code menu or use a keyboard shortcut.
the Comment with Line Comment command works just fine.

none of the Live Templates seem to work for me - i assume that i'm supposed to be able to type 'sout' and then TAB or 'inn' and then TAB and have the IDE expand these templates ?

can anyone point me in the right direction ?

many thanks in advance ...

0
15 comments
Avatar
Permanently deleted user

does intellij log file shows any errors?
Also check the livetemplate autocompletion key (space or tab key), further,
what happens when you press CTRL+J?

0
Avatar
Permanently deleted user

hi there,

thanks for taking the time to reply - much appreciated !

the log file shows an error which appears to be an attempted download from jetbrains - com.intellij.platform.templates.RemoteTemplatesFactory$1.compute
the server i'm working on doesn't have access to the internet.

CTRL+J displays a message - 'No templates defined in this context'

can i download the templates manually and copy them across to the server ?

am i right in saying that this shouldn't affect my ability to apply comments with block ?

thanks again. :-)

0
Avatar
Permanently deleted user

so i've managed to get the default live templates to appear by adding a new one.

unfortunately, i can't get any of them to work - pressing TAB does nothing and changing the 'Expand With' setting doesn't help either.

can anyone suggest anything ?

thanks in advance ...

0

Please select the template in Settings / Live Templates and check small label with "applicable" word at the bottom. Are the contexts Ok? Try the Change link if not yet.

Regards,
Alexander.

0
Avatar
Permanently deleted user

hi Alexander,

thanks for taking the time to reply !

your suggestion has fixed the templates issue which is very useful - i hadn't noticed that option at the bottom !

any ideas regarding my comment issue ? i still can't use the CTRL+SHIFT+/ keybvoard shortcut or menu command.

thanks again - much appreciated !

0

Do you try to use Comment with Block in Java? Can you provide a code snippet?
Do you use it when something is selected in the Editor? What is selected?

Alexander.

0
Avatar
Permanently deleted user

Hi Alexander,

I'm basically trying to select a line or two in the editor - anything - and have it commented out - //isAdmin=false;

e.g i select a piece of code or just have the cursor on that particular line -

isAdmin=false;

When i select Comment with Line Block from the Code menu or use the keyboard shortcut, it works as expected.
<%--isAdmin=false;--%>
If i select Comment with Block Comment nothing happens.

I'm editing a jsp page in the editor if that makes any difference - it's not 'pure' java code as it's mixed with HTML, etc.

Thanks again. :-)

0

In arbitrary dummy case the action works for me.

Looking at the snippet:
<%--isAdmin=false;--%>
I presume, the text "isAdmin=false;" is not inside a scriptlet, but is a template text? Is that true? Because otherwise it would be commented so:
// isAdmin=false;
Or so:
/*isAdmin=false;*/

Thanks,
Alexander.

0
Avatar
Permanently deleted user

Hi Alexander,

it's basically a standard jsp page - the text is inside the standard <% and %> tags

the editor does seem to be picking up the content type of the page incorrectly as the comment format suggests an html page ?

do you know of any way to check the content type or force it in any way ? i suspect that may solve the problem.

many thanks !

0

If so, could you attach a sample of such JSP where the commenting doesn't work?

Thank you,
Alexander.

0
Avatar
Permanently deleted user

Hi There,

Even a simple snippet such as this (inserted into a new, blank page) results in the wrong type of comment (and no block comments)

<%
        
        <%--System.out.println("test");--%>
            
%>


I'm not sure how the current current document 'type' is being determined ?

Thanks

0

Right question. It's by the file name pattern (typically, by the file extension). Please check:
1. Your file extension.
2. What category is it in Settings / File Types?

If you have JavaEE and JSP support plugins enabled, .jsp files should have proper type. Maybe a plugin is not enabled?

Regards,
Alexander.

0
Avatar
Permanently deleted user

Fantastic !

It looks like although the jsp file is being classified correctly, it's applying the wrong type of comments for some reason.
When I configure jsp files to be treated like Java files everything works as expected.

Hopefully I can either change the comments style of just leave the configuration change.

Many, many thanks for your assistance - I appreciate you taking the time to help a complete stranger.

:-)

0

Well, the last thing to check is whether the .jsp extension is also registered in another type.

Also third party plugin disabling could help, if there are any.

You're welcome,
Alexander.

0
Avatar
Permanently deleted user

I haven't installed any third-party plugins (that I'm aware of) but I'll make sure that the JSP file extension is only handled once.

Thanks again !

0

Please sign in to leave a comment.