Komodo Edit - Autocomplete filling script tag with wrong attributes - komodoedit

I am using Komodo Edit 8.0. Whenever I add a <script> tag, it fills my tag in with
<script type="application/x-javascript"><!CDATA[
//]]>
How would one change what Komodo fills in for the script tag?

Komodo dev here, this is because "script" triggers an auto-abbreviation. Which is a snippet in your toolbox with the name "script" which has the "Auto-Abbreviation" toggle enabled. Please have a look at the Snippets documentation: http://docs.activestate.com/komodo/8.0/snippets.html
You can turn this off either specifically for "script" by toggling the "Auto-Abbreviation" checkbox or globally by toggling "Enable Auto-Abbreviations" under Preferences > Editor > Smart Editing, in this same area you can also change what would trigger these auto-abbreviations. For example I have it configured to only trigger on "\t" (TAB) so that can press TAB to trigger an abbreviation.

Related

Can I customize the "New File" menu in PhpStorm?

I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.
I tried using Appearance & Behaviour -> Menus & Toolbars but that didn't work for me.
Do you know that you can use the universal PHP Class entry and just change the type of the object (and therefore the file template) there? That can be done right away when typing the file or class name -- just use Arrow Up / Down keys:
(GREEN rectangle area is where that Up / Down key will work; RED rectangle shows my custom file templates)
P.S. The template for PHP Enums is also there, it just the screenshot was taken in a project with PHP 8.0 language level (need 8.1 for enums to appear).
P.P.S. The IDE will remember the last used template when you invoke this dialog again.
https://www.jetbrains.com/help/phpstorm/creating-php-classes.html
You can add new entries to this menu by creating custom File Templates at Settings/Preferences | Editor | File and Code Templates
https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html
Here are my test custom file templates:
And this is how they appear in that menu:
Customizing this menu (removing items, changing their order)
This is not possible at the moment. https://youtrack.jetbrains.com/issue/IDEA-143090 -- watch this ticket (star/vote/comment) to get notified with any progress.

How to auto-generate comment using custom shortcut in IntelliJ?

I'm trying create a custom shortcut in IntelliJ to generate some predefined comments.
For example, if I write //-- and press enter, it should auto-generate:
//------------------------------------------------------------------------------//
//------------------------------------------------------------------------------//
The Postfix Completetion feature looks like it could be used for this but I didn't figure out how to set it up for this scenario. Can someone help?
If Postfix Completetion is not the answer, can I do it with another feature?
You can create a Live Template (Preferences | Editor | Live Templates). For example, a template like the following:
//------------------------------------------------------------------------------//
$END$
//------------------------------------------------------------------------------//
The $END$ indicates where the text cursor will be placed when the Live Template text is inserted. At the bottom of the Live Template settings screen you can configure in which languages/contexts the Live Template should be available.

Can I have multiple cursor points in live templates in intelliJ IDEA using the $END$?

I can't seem to find a solution to having multiple cursor points in live templates in intellij IDEA
There is not a way to do have the cursor end at multiple points. But you can repeat the same variable in multiple places in your template, Then as you edit that variable, it changes in all the locations.
For example, this simple example will create three variables of the same type, the type of which I enter/edit after I expand the template. The actual template is below. You can copy it to your clipboard and then paste it as a template in the Live Template settings dialog. In the example, I used a variable named EDIT.
<template name="meex" value="$EDIT$ a;
$EDIT$ b;
$EDIT$ c;" description="Multiple Edit Example" toReformat="true" toShortenFQNames="true">
<variable name="EDIT" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
UPDATE
To answer the OP's question in the comment...
To use the example template:
Copy the XML snippet shown above to your clipboard. Make sure there are no leading or trailing spaces or blank lines
Go to Settings (Ctrl+Alt+S / ⌘,) > Editor > Live Templates
On one of the grouping directories, such as "User", right click and select paste (or just type Ctrl+V).
This will paste the live template into the "User" group. Notice (A) the abbreviation (I chose "meex" for "Multiple Edit EXample") and (B) the "Expand with" setting.
Click OK on the Settings Dialog
Use the template by typing meex (or whatever abbreviation you set in step 4A) and then hitting Tab (or whatever Key was defined in Step 4B).
Start typing to the edit $EDIT$ placeholder variable, and hit Enter when done.
You can learn more about Live Templates in the IntelliJ IDEA help documentation here: https://www.jetbrains.com/help/idea/live-templates.html The best way to learn about them is to look at included templates, make a copy of them (Just right click one, select copy, then paste it elsewhere) and then edit the template and look at how the variables are configured in the "Edit variables" button on the template settings dialog. You probably do not want to edit the included templates directly so you do not corrupt them. And before playing around, you may want to back them up, just in case. Exporting them is the easiest way. See the "Sharing live templates through export/import" section at https://www.jetbrains.com/help/idea/sharing-live-templates.html

How to format curly braces for autoformat in intellij

Whenever I hit alt-cmd-l to autoformat my code, it formats my imports and arrays from:
import { CommonModule } from '#angular/common';
let arr = [ myStringVar ]; // simple example, just go with it
to
import {CommonModule} from '#angular/common';
let arr = [myStringVar];
How do I tell IntelliJ to put a space after the opening brace and before the close brace when auto-formatting? (Specifically for javascript, typescript)
I've looked around for the answer and could not find one or asked the question badly. So I apologize if this is duplicate.
I'm on Intellij 2016.3.3
Go to preference, select Editor > Code Style > Javascript and choose Spaces, check the checkboxes in Within section "ES6 import/export brances", and if you want spaces in object literal braces, check "Object literal braces" and as well.
Go to settings and search for ES6 import/export braces. It should take you to Editor -> Code Style -> Javascript (or TypeScript). Just hit that checkbox on the spaces tab and it should add the spaces back.
As you are using Angular, I believe you need to edit the settings for the Typescript and NOT for JavaScript. As I am using IntelliJ IDEA 2021, I will give you the fix for the same. You can do so by going through the following path:
Go to File > Settings... > Editor > Code Style > Typescript
Click on the Spaces tab.
In the Within collapsible, tick the checkbox that says "ES6 import/export braces".
Click on Apply button and then click on Ok button.
If you now go to the Typescript file and hit the combo: Ctrl + Alt + L, it should now format the file correctly.
CAVEAT:
You have to be careful to ensure that you are making the changes for the Scheme that is applicable for your project. For example, maybe you have customized your Editor in some way previously and saved your customizations under a new name, such as MyCustomSettings. Once you do this, you will notice that there is an additional Scheme called the Default scheme. But MyCustomSettings will be your Scheme for your project and you have to make sure that you make the changes for the MyCustomSettings Scheme and not for the Default scheme. You can refer to the Schemes via the following path:
File > Settings... > Editor > Code Style > Typescript, there is a dropdown referred as Scheme. Choose the appropriate one for your Project and make sure you make the above edits in that Scheme.

Aptana won't save editor preferences

I've got a little (big) problem in Aptana. Whenever I try to edit my settings for a specific editor, I click "Apply", then "OK", but my preferences don't get saved, and if I open the settings again, the default ones are shown. What might be causing the problem?
I'm using Ubuntu 11.04 with Aptana build 3.0.4.201108101506.
I'm looking forward to reading your suggestions.
Alessandro Desantis
EDIT: The situations changed with version 3.0.5. Now, YAML editor's preferences get erased when closing the settings window as before, while others editors' ones are overridden with defaults when closing the IDE... This is very strange.
open preferences (settings)
click General
click editors
click text editors
change displayed tab width to 4
check insert spaces for tabs
click apply
click ok
open preferences (settings)
click aptana studio
click editors
click YAML (or desired editor)
change tab policy to use spaces
change tab size to 4
this worked for me