I have 2 problems i can't seem to fix:
1) For some reason Komodo won't highlight any methods in my .e files, even though the default language is specman-E, and the file set to the proper language.
How can i get him to highlight it?
2) After i press enter komodo wont indent properly if inside a function or an "if" statement.
for example:
what komodo does when i click enter:
if(injection_flag){
gen packet2inject;
};
what should be when i click enter:
if(injection_flag){
gen packet2inject;
};
any help would be highly appreciated.
<'
// hello world
extend sys
{
run() is also
{
out ("Hello World");
};
};
'>
Smart Indent does not support specman-E, so indent the initial statement manually with tabs or spaces, then the newline will start at the same level of indentation. Syntax highlighting works, but is very basic.
Related
Normally, to create a new bracket block I would type:
"{" then enter
This produces:
{
}
however, (I have seen this on two different machines so far, it might be the default setting) if like me, you like to keep shift held down, or accidentally keep it down and instead press shift + enter, it creates a new line underneath.
{ }
//current cursor position
Leaving the un-formatted brackets behind!
This is really annoying as I nearly always do this, and have to fiddle around for a little second to get the brackets back to where I want them. What can I do to change the behavior of shift + enter?
Go to Options > Environment > Keyboard
Search for Edit.SmartBreakLine and remove the assigned shortcut (Shift + Enter)
Search for Edit.BreakLine, click on "Press shortcut keys:" textbox, press Shift + Enter and click Assign
If it doesn't work try restarting Visual Studio.
Update: This issue is fixed in Visual Studio 2015 Update 1 - SmartBreakLine works as expected.
We stumbled on this thread and it felt like we could make a nice improvement here to Shift+Enter (SmartBreakLine).
So, in cases where a block was opened { } and if shift was held down intentionally or unintentionally, we now do this:
{
|
}
instead of
{ }
|
this way people who are used to using shift+enter to complete the line (in C#, it adds a semicolon to the end of line if needed, formats the line, adds a new line after current line) do not have to lose those functionalities by remapping the shortcut to BreakLine.
See: https://github.com/dotnet/roslyn/pull/5790
this should make it in the next update of Vs2015 and we hope you like it.
It works well in my VS 2015. Try resetting all the settings.
Tools > Import and Export Settings > Reset all settings > Next > Visual C#
You can reset for all other languages similar like this.
Hope this helps!
Is there a keyboard shortcut or fast way to change the code below to a single line in Visual Studio 2013? I also have ReSharper installed.
Multi
new XElement("Option",
new XAttribute("Name", "FileDelete"),
"1"
),
Single
new XElement("Option", new XAttribute("Name", "FileDelete"),"1" ),
Just select all the text
and press (control + j)
and it will become 1 line of code
I setup find/replace for quick use with a regex expression like so:
(note: I use VS 2015, so your hotkeys may be different)
Use Ctrl+H to open quick find replace.
Make sure the "Use Regular Expressions" button is active/toggled-on, and that you are set to search in "Selection" (Not "Document" or "Entire Solution" or whatever)
Type
\s+
and a space ()
in the "find" and "replace with" boxes respectively.
Press Esc key to exit quick find/replace.
Now, as long as you don't change anything, you can select any text you want to make single line, and use the following hotkey sequence to quickly format it:
Ctrl+H (Open quick find/replace)
Alt+A (Replace any occurrence of 1 or more White Spc chars with a single space.)
Enter (Close the popup window that says "X Occurrences Found")
Esc (Exit quick find/replace and return to your code)
I use this all the time after visual studio does things like implementing interfaces to turn stuff like
public SomeType SomeProperty {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
into stuff like
public SomeType SomeProperty { get { return someField; } set { /*Some Simple Set Code*/; } }
For VS2019, default binding is set to Shift + Alt + L + J
Or you could rebind this to something else by going to Tools -> Options -> Keyboard -> search for 'join'
Rebind Edit.JoinLines action to something like (Text Editor) Ctrl + J then press Assign
To make it with ReSharper, you should uncheck the option "Keep existing line breaks" in ReSharper/Options/Code Editing/C#/Formatting style/Line Breaks and Wrapping.
Or just add this line into your .dotSettings
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/#EntryValue">False</s:Boolean>
Then you could format your code using Code Cleanup Tool (default shortcut is Ctrl+Alt+F) or just by typing semicolons or braces.
For me doing Ctrl + J opens the Linux terminal and does not format multiple lines to one line.
This is the fastest way on Linux
Hit Ctrl + Shift + P
Join Lines
You can change your VS settings to automatically format code in whatever way you want, then select and retype any line/block-ending character (';' or '}') after the text you want formatted and VS will format it for you.
You can accomplish this using CodeMaid. The default keybinding is F3, but the command is called CodeMaid.JoinLines if you want to change it
PHPStorm is a very nice IDE, but it does one thing that annoys me.
I (and my team) write our switch statements like so:
switch ($foo) {
case 'a' :
// some code
break;
}
PHPStorm auto-corrects this to be
switch ($foo) {
case 'a' :
// some code
break;
}
Note that the break is indented along with the code. I don't want this to happen.
I've looked in the code style section, but the only option for switches is to indent the case branches.
Does anyone know how stop PHPStorm from doing this?
You can change this default behavior in
settings | Editor | Code Style | PHP | Wrapping and Braces
uncheck indent 'break' from 'case' option
Based on the recommendations in PSR-2 on code style, PHPStorm displays it the recommended way.
If you really want to change it, you can do it in Editor > Code style > PHP > Wrapping and Braces under the 'switch' statement and uncheck the Indent 'break' from 'case.
Disclaimer, the screenshot is from IntelliJ, but you should be able to find the same setting in the same location
Press Ctrl+Alt+S to open the Settings .
Choose Code Style -> PHP as below
Change the Continuation Indent value to 0 as shown. Done.
Maybe you also have to go by the logic that the application is pointing out, a break is not necessarily the end of a case statement. You could have comments after the break statement, both logically and visually. The break is a child of that particular case statement.
My google fu is failing me. Visual Studio and Resharper helpfully provide closing brackets and the like. For example, typing "var foo = new Foo(" immediately inserts a ). Great! So I go to insert a bunch of other stuff. I know I can just type in the closing characters and it'll gloss over fine, but when I do something like this...
var foo = new Foo(new Bar()
{
Something = 48,
SomethingElse = new Fred(new Bob())
};
Right after typing Bob the rest is generated. I want to be able to cleanly move to the end of that generated code and move to the next line without touching the arrow keys. A simpler example:
if (something)
{
Something();
}
That last curly brace is made for me, but I want to go past it without touching the arrow keys. Is there any shortcut that I'm missing?
Just keep typing. Type the closing ")" (ReSharper will move past it), then the semicolon (ReSharper will enter it).
Geany is the closest thing I can find to the perfect web development IDE. However, I can't find a way to automatically close curly brackets ({).
For example, typing:
function test()
{
..and pressing RETURN should cause this to happen:
function test()
{
// cursor ends up here (indented by 1 tab)
}
Is there anything that can make Geany do that?
This is a native feature of Geany,
Go to Preferences, then Completions, down there you can choose which one you want to auto close.
Check here for screenshots
You make something else:
If you want, open https://plugins.geany.org/autoclose.html and see "autoclose" plugin. You can install with :
sudo apt-get install geany-plugins-autoclose
and It is all
That isn't full answer to your question, but may be helpful.
I have Geany not in english, I make translations of menu's fields on my own.
Geany has a feature: when you type special text and press Tab, the text is going to be replaced with another text.
It works by default for if, else, for, while, do, switch and try.
Configuration of this feature is in [Tools]/[Config files]/[snippets.conf].
After doing some changes, save file and click [Tools]/[Reload configuration].
I added two lines to section C++:
class=class %cursor%%block%;\n
struct=struct %cursor%%block%;\n
With block=\s{\n\t%cursor%\n}
It doesn't let you press { Enter or { Tab to get
{
//cursor
}
because {=anything is ignored, I don't know why.
What you can do? You can have some another text, replaced using {\n\t%cursor%\n}, or define keybinding inserting it.
Geany can have user defined snippets. It is possible to open snippet configuration file from menu.
Tools ->
Configuration files ->
snippets.conf
Go to the language block where you want to add that feature.
For example:
[C]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (i = 0; i < %cursor%; i++)%block_cursor%
while=while (%cursor%)%block_cursor%
do=do\n{\n\t%cursor%\n} while (%cursor%)\n%cursor%
switch=switch (%cursor%)%brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
At first it can be thought that the problem can be fixed just with adding this line
{=%\n{\n\t%cursor%\n}%
But Geany does not accept that when snippet is one non alphabetic character.
It will work for any other alphabetic character like this
b=%\n{\n\t%cursor%\n}% or bl=%\n{\n\t%cursor%\n}%
However I dont think it is what you want. The real solution you can find from geanys menu.
Edit
->Preferences
->Editor
->Completions
Tick the Auto-close quotes and brackets then click on apply and save
The Auto-close doesn't work if we place brackets inside another pair of brackets. For example, the inner bracket doesn't auto-close.{{|}
However, we can use the following snippet to create a block.
{={\n\t%cursor%\n}
But in order to use this snippet, we first have to include '{' char in our wordchars set by changing the below line in snippets.conf file.
wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{