Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more postfix completions #2288

Open
fbricon opened this issue Oct 24, 2022 · 4 comments
Open

Add more postfix completions #2288

fbricon opened this issue Oct 24, 2022 · 4 comments

Comments

@fbricon
Copy link
Contributor

fbricon commented Oct 24, 2022

Compare jdt.ls postfix proposals:

Screenshot 2022-10-24 at 09 44 23

to IDEA's:

Screenshot 2022-10-24 at 09 41 28

I'd prioritize the for* and sou* proposals

@jdneo
Copy link
Contributor

jdneo commented Oct 26, 2022

The list of postfix (from IDEA):

Status key in JDT.LS key in IDEA template content
! !expr
arg functionCall(expr)
assert assert expr
cast cast ((SomeType) expr)
castvar T name = (T)expr
else else if (!expr)
field myField = expr
for for, iter for (T item : expr)
fori fori for (int i = 0; i < expr.length; i++)
format format String.format(expr)
forr forr for (int i = expr.length-1; i >= 0; i--)
if if if (expr)
instanceof, inst expr instanceof Type ? ((Type) expr). : null")
lambda () -> expr
new new T()
not not !expr
nnull notnull, nn if (expr != null)
null null if (expr == null)
opt Optional.ofNullable(expr)
par par (expr)
reqnonnull Objects.requireNonNull(expr)
return return expr
syserr serr System.err.println(expr)
sysouf souf System.out.printf("", expr)
sysout sout System.out.println(expr)
sysoutv soutv System.out.println(expr)
stream Arrays.stream(expr)
switch switch(expr)
synchronized synchronized (expr)
throw throw throw expr
try try { exp } catch(Exception e)
twr try(Type f = new Type()) catch (Exception e)
val, varl lombok.var name = expr
var var T name = expr
while while while (expr) {}

@rgrunber
Copy link
Contributor

rgrunber commented Jun 8, 2023

Clients may need to consolidate their snippets (if such support exists) the more we start offering from the server-side. For example, vscode-java provides its own switch snippet (no context), but if we did add our own switch server-side (for postfix), there would be an annoying duplicate. Clients would need to enable/disable certain snippets based on whether postfix is enabled.

We'll definitely need to review how we contribute snippets as there's advantages/disadvantages to server-side & recommending client-side.

Update: Similar discussion at redhat-developer/vscode-java#2867 (regarding snippet consolidation) .

@baober90
Copy link

I can not use postfix in lambda.
for example:
image
there is no .var postfix for cmp

@jdneo
Copy link
Contributor

jdneo commented Sep 18, 2023

@baober90 We do have some issues about the lambda support. Root cause is that the AST parser could not properly parse the AST when it comes to lambda expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants