SSMS - auto complete Parameters (intellisense) - tsql

I already got used to intellisense failing (cant really blame it, sql is weird per design) and I know I can "resfresh" it with (CTRL + SHIFT + R) - which sometimes even works.
What makes me mad is the "parameters peek" when I start writing a funktion call. It lists all parameters and highlights (bold) the parameter that is expected at that position.
As soon as something goes "wrong" the "parameter peek" disappears and never shows itself again. (i.e. dbo.SomeFunc(#val1 int , #val2 int) ... start writing "dbo.SomeFunc " and the "peek" will show up. Now insert "-1" instead of "1" and see it fail.)
This drives me crazy, is there a way to bring it up again? (Alt + Space or so?)
I dont know what that "parameter peek" is called and if it is part of intellisense or not. If its not possible to show it again, it would be nice to deactivate without the other intellisense funktions. I tend to rely on it when it pops up and go mad when it disappers again. >:(
SSMS v17.3 (14.0.17199.0)
Thanks in advance for any hint
Jan

Retyping the opening parentheses ( for the parameters does the trick for me in SSMS 2017.6

Related

Visual studio 2022, Press '(' on selected text not working (as expected)

I don't know how to describe this behaivor:
Press ( key on selected text in vs2022, what i want is to replace the whole selection with (, but it does not, even worse, what it does is to add another ) to the end of the selection, this is really annoying and happened many times. i tried to find options in Tools/Options, twice, and nothing found to disable it.
(actualy, it happens to all marching symbols like "(<{, so i guess it's something to do with the brace marching thing.)
Please help, thank you.

Oracle sql developer - Auto clean 'script output' on every execution

In the worksheet, each time command is executed, it's output is added to "script output" page.
But the result from last executions is not cleared and it is very confusing.
Is there any way to auto clear all other outputs except the last one (instead clear manually each time)?
I did searched for solution but didn't find anything I can try.
Thanks
Attached the screens after first command and second command
First run:
Second run:
As far as I can tell, there's no such option. If you go to "Preferences" and search the whole list, there's nothing like that in there. Or, at least, I don't know it.
What you could do is to type
clear screen
(or even shorter, cl scr) in Worksheet.
Or, if you type fast and don't make much mistakes, press combination of
Alt + PgDn to navigate to script output
Ctrl + Shift + D to clear contents
Alt + PgUp to return up
Or, simply push the eraser icon in the toolbar.

Making a basic query on PSQL does not display anything

I have connected to my PSQL database on command line and can run commands like \dt or similar just fine.
However, when I type in a basic query such as SELECT * FROM myTable and hit return, it does not display anything and just goes to the next line waiting for another command.
Any idea why?
You need to terminate the query with ;
SELECT * FROM myTable;
There is actually a less obvious cause of the above. If you've ommitted a closing bracket ()) somewhere in the query, you'll get the same behaviour. E.g.
SELECT *
FROM some_table
WHERE (NOW() - date_value;
It won't attempt to execute the statement until it gets a closing ); before it spits out a syntax error. While the above is fairly obvious where the issue it, it gets a lot trickier to spot with more complex queries. To get out of it, close with multiple brackets ))))))))); which will still resolve and spit out the syntax error so you can continue and correct.
A way to spot if this is the case, is to use the Up arrow through your history - if you're not seeing your previously typed (but not yet executed) statements, then you know you're still in a state where it's trying to close the statement before attempting a syntax check.
The issue isn't limited to brackets, but any other closing symbol such as quotes. The trick is to pay attention to the psql prompt as it shows the parsing state. E.g.;
DATABASE=> the => means all is normal and it's parsing a single line
DATABASE-> the -> means you're on a new line and likely missing a ;
DATABASE(> the (> means you haven't closed a bracket
DATABASE'> the '> means you haven't closed a quote.
Etc, you get the idea.
I fixed this exact issue by clicking the maximize button in the top right corner of the query terminal. (PGADMIN4 - PostgreSQL 15)
I'm using PostgreSQL 15 and was running queries. I then maximized the query terminal, and following that, I was no longer able to view the query that was ran successfully. I then clicked the maximize screen and found that the results had simply been hidden behind the maximized query terminal.
Hope this helps!

Eclipse Code Assist inside method or type name

I'm used to Visual Studio, where when you start typing System.Context list will appear and you will be able to choose not only from type names that start with Context, but also from names like ActivationContext.
This gives me the ability to quickly find a method just by guessing it's name. Especially important when I'm beginning to learn to program for Android. For example, I was sure that ListView must have a method for setting ListAdapter, but I was dumb enough not to figure it will be just setAdapter. In VS I would just type adapter and setAdapter would have appeared.
Is there something similar in Eclipse?
In Eclipse you can use the keyboard shortcut Ctrl + Space and it will try and suggest items for you. You can do this after you have already started typing in a piece of the "suggestion". It is a little more strict:
Example: On a String object, you try and find, equalsIgnoreCase() (your string is called test). Typing test.e then CTRL + SPACE gives three options (endsWith, equals, equalsIgnoreCase). If you type test.ignore then CTRL + SPACE you get no results. For filtering help, you can just use test. and then CTRL + SPACE and it will show all results so you can hunt that way.

What's the trick to write code faster in Eclipse?

I know there is a trick that when you type quickly code in Eclipse, you can hit some secret keys and it will auto-complete the missing parts. Who knows them?
example: I have someVeryLongVariablesWhichIWantToTypeFast and I start typing someVeryLongVa but nothing happens. Only when I type method names a yellow box appears that wants to help me.
Ctrl + Space is the autocomplete shortcut
All shortcuts you can find under Window -> Preferences -> General -> Keys
As mentioned the command is Ctrl+Space to auto complete.
You can speed it up using camelCase...so in your example:
someVeryLongVariablesWhichIWantToTypeFast
you could start typing sVL then Ctrl+Space should auto complete or list all variables that match.
CamelCase also works for specify classes, searching for classes etc.
Others I like/use:
type sysCtrl+Space to get System.out.println statement (or err)
type foreCtrl+Space after an array/list line to foreach it
Click on an argument to a method and Ctrl+1 to create a field for it and assign it, great for constructors
Ctrl+1 on any local variable to convert to field, split declaration, or inline it
if you have
object.method().method2().method3()
selecting object.method() and type Ctrl+1 to assign to a field or local variable, then you get
Object objLocal=object.method()
objLocal.method2().method3()
//Can now select objLocal.method2() and do the same again
My favourites:
Ctrl + Space - auto complete
Ctrl + 1 - show quick fix options when you are over an error / warning
Shift + Ctrl + L - list short cuts
One trick that I love in Eclipse for Java is writing backwards (meaning you write the client before the code it calls). We typically think of autocomplete to help us with methods and variables that already exist. This is okay, but even cooler is when a method/class does not exist.
Try typing this code into a method (anywhere, really):
Who who = new Who();
who.whatUpMan("hi", 32);
Now left-click on the Who at the beginning. It will give you the choice to create a class, interface, enum, etc.
Now left-click on the whatUpMan. It will prompt you to create the method with the right parameter types and everything.
These are called "Quick Fixes" in Eclipse and they give you total freedom to code from the client "backwards" to classes it utilizes. And when you've already got the method, of course, control-space and control-shift-space (to see parameters for methods) are your friends.
http://eclipse-tools.sourceforge.net/EclipseEmacsKeybindings_3_1.pdf
Some more time savers that don't seem to be mentioned:
Ctrl+3 'Quick Access' which basically let's you reach anything without clicking around too much. E.g. type 'nav' in the popup dialog, rather than Window | Show View | General | Navigator or wherever it is.
Ctrl+O 'Quick Outline': when editing Java (and some other things), pops up a lighweight dialog so that you find anything in the file by a few keystrokes
Shift+Alt+T 'Refactoring', and things below that menu - look for shortcuts there, use 'Rename', 'Move', 'Extract method', 'Change method signature' often
Alt+Up/Down move blocks of code up/down without cut/paste
Alt+Shift+Up/Down select various levels of code (expressions,statements, methods, class) easily
Ctrl+1 on the selected code offers you cool stuff eg. Extract to variable/constant/method; Split variable declaration -- see others above, or just try it on anything
Ctrl+Shift+R find any file in the workspace, similar to Ctrl+Shift+T to find types
Ctrl + Shift + O : resolve all dependances automaticall. In Java, it's a life saver as it cleans old packages and add the required one without a single line to write.
"Right click" then "refactor" : all the features are handy, but I espacially love "rename" (Ctrl + Shift + R, c.f comments) because it will apply the changes to all the project. No more tricky find / replace wit regexp to do ensure you breal nothing else :-)
"Right click" then "source" : equally useful, with a special mention to "generate getter and setter" and "implement methods"
Ctrl + D : delete a line. Kinda cool.
I kind of remember CTRL+SPACE was the shortcut for autocomplete.
Another time-saver is formatting the code automatically using Ctrl + Shift + F.
Formatter preferences http://img187.imageshack.us/img187/5866/eclipseformatter.png
General Eclipse tips
Get rid of all the crap that you'll never use
if you do web-dev ... install the database, php, pydev, modules and plugins
install svn/cvs/git plugin
use Trac
have different code enviornments for different code types, i.e. one for python-dev, c++, and so on.
wait a few weeks to months before updating
i have about 100 premade mini scripts that i use frequently.
learn to develop your own plugins, as it's easy and fun.
For some applications, the answer is to generate the code using EMF. But the EMF learning curve is significant.
I would suggest go to Eclipse -> Preferences -> General -> Editor -> Keys and to configure your own keyboard shortcuts for all common tasks so that you can have custom keybindings that are perfect for you.
Probably this might not exactly answer your question but it is very relevant to your question title.
You can define templates in Eclipse to magically type and get a bunch of code typed for you. For instance you may type something like syso or sout to get System.out.println() in your Java code.
This can be done by following Window -> Preferences -> Java -> Editor -> Templates. You can also add a Template View, which you find at Window -> Show View -> Other -> Search for Templates.
Here is an image to clarify
* Original related answer in here as well.
Hope it is helpful to someone :)