VIM to Aptana: indent three lines, or entire block - aptana

Suppose one has the following code open in Aptana Studio 3:
function doSomething()
{
foo();
bar();
baz();
}
With the cursor on the foo(); line, how might I indent the line and the two following it? In VIM this is 3>>. For that matter, how does one auto-indent the entire block? In VIM this is =%.
Note that Aptana has a link to Stack Overflow when clicking "Browse Discussions" on their Support website.

Related

Add proper selector for keybinding event in Atom editor

I develop a package, which allows user to use Home button to toggle cursor position in soft-wrapped lines, as it is in Komodo Edit editor.
In my toggle() function I try to get active text editor from Atom Workspace using getActiveTextEditor function and then I do my logic.
atom.workspace.getActiveTextEditor()
I bind a Home key with a selector atom-text-editor.editor, and it mainly works fine until triggered inside Search&Replace pane or Command Palette.
"atom-text-editor.editor": {
"home": "toggle-home:toggle"
}
In this case, getActiveTextEditor returns always a currently edited file's text editor. It leads to a situation, when a cursor is moved inside an edited file's pane, but not inside focused field. When I use a Home inside a text field in Settings pane, Atom throws an exception, as it can't find any active text editor.
I did a research through Atom Docs, Atom API, even community packages, but all I found, was adding 'mini' to my event selector, to narrow event scope a bit.
"atom-text-editor.editor:not([mini])": {
"home": "toggle-home:toggle"
}
Nevertheless it still causes exception or misbehaviour in text fields without 'mini' (ie. textarea of Git/GitHub package).
What I want to achieve is:
1) to find a proper keybinding selector, that would fire only inside currently edited file pane;
OR
2) to find a method to get focused instance (Search&Replace, Command Palette or any other field) for further processing.
Solution
As DamnedScholar mentioned here:
the selector atom-workspace-axis.vertical atom-pane-container atom-text-editor:not([mini]) will do it.
Already tested, works fine.

Atom code editor - insert html comment

I'm aware of the shortcut (Mac) CMD+/ to comment out (HTML style) a line. Is there a shortcut or a way of doing the following. When I press a keybinding, the comment tags are inserted where the cursor is and the cursor gets moved inside the tags to write a comment (x):
<!-- x -->
Try inserting two hyphens and pressing TAB. It should expand to a full comment block with the cursor inside. It is a snippet.
Select the code you want to comment out and press Ctrl (or Command) + /

How can I fix (or ignore) javascript errors in Visual Studio 2015

I have a solution whose startup project is an ASP.NET website (the kind without a .vbproj file)
When I'm running in debug mode, the first error I get is a popup
Unhandled exception at line 539, column 51 in script block
0x800a138a - JavaScript runtime error: Function expected
The code "file" is called "script block [dyanmic]" so I think this js is being created by VS or it's a third party code, which means I probably can't fix it. This bold portion of the code below was in yellow when I did a "break". (sorry, I don't know how to highlight a portion of a code block in stack overflow)
function LPCTR(a){var b=0;if("undefined"!=typeof g_isdebug&&g_isdebug||"undefined"!=typeof debug&&debug)init_LPctr(),b=LPctr.increment(a);return 0!==b}
I'm getting several errors similar to this.
How can I ignore these errors?. There is an "exception settings" window in the IDE, and I have "JavaScript Runtime Exceptions" completely unchecked. (My site appears to be working otherwise)
How can I find the "owner" of this code? I don't have a LPCTR function.
If you right click the eror window and at the bottom select to clear javascript errors. They are gone and will not appear next time you compile your project.
Put the code in a try-catchblock
try {
// Your code here
} catch(e) {
// Code run on error, with info var e
}

Make JavaFX window active

I am trying to make a JavaFX application (running in the background to show up (set visible)) by a specific keystroke and to make the window the active window immediately. Therefore I set the primary stage alwaysOnTop-property true, call stage.toFront() and finally call stage.requestFocus(). Afterwards I request focus for a text field. When the window is made visible I would like to instantly start typing into the text field.
However, when I for example have a Ubuntu-terminal selected and make the window visible and start typing, the application is shown on top of everything, however, the typing goes to the terminal. The application window is not active! Nevertheless, the focused property of the stage is true. Is that a bug or am I missing something? Is it OS related?
Edit: I am willed to give my little hack-around for this problem that I am using at the moment, because the internet is suggesting, that a lot of people are facing this problem: Since I am working on a linux maschine I have access to the wonderful tool wmctrl. It is part of most standard repositories. wmctrl -a WINDOWNAME sets the window with the name WINDOWNAME active. For now, I simply call this tool from my source code when I need the window to be active. Since this is more of a dirty hack than any thing else, I sure want to get rid of it.
Not perfect, but it works:
Platform.runLater(() ->
{
//primaryStage.setAlwaysOnTop(true);
//primaryStage.setAlwaysOnTop(false);
primaryStage.setIconified(true);
primaryStage.setIconified(false);
});
If your node is not getting focused, try wrapping requestFocus() in a Runnable and call Platform.runLater():
final TextField text = new TextField();
Platform.runLater(new Runnable() {
#Override
public void run() {
text.requestFocus();
}
});

Aptana Studio 3 - Can't check typo errors?

I'm using Aptana Studio 3 for learning JavaScript. I'm start to like this IDE but one of its disadvantages is that when I made a type error such as:
if (comfirm("are you sure ?")) // "coMfirm", the right one is "confirm"
{
alert("you answered yes");
}
else
{
alert("you answered NO");
}
Then when I hit the Run button, the IDE just ignored this error and continue to run my current file. I think this kind of errors is so hard to be recognized by naked eye & it makes my learning progress meets many difficulties.
it's not a matter of Aptana Studio but a matter of Javascript.
Use Firefox to run your code. Then in firefox right click your page and from the menu select the last item (with (Q)). In firefox below opens a new footer select "Console" and "JS". It will show you the error 'ReferenceError: comfirm is not defined' and on the right edge it shows the filename and line number.

Resources