Skip to content

Conversation

@mickaelistria
Copy link

No description provided.

datho7561 and others added 30 commits May 29, 2025 13:23
- do not erase bodies of methods in anonymous classes and class
  statements
  - this is over-permissive at this point,
    we'll need to refine it later

Signed-off-by: David Thompson <[email protected]>
eg. completion at `|` should yield VALUEABLE_1 and properly filter out
eg. methods and non-static/final fields.

```java
public class DemoClass {
	void thisMethod() {
		int i = 12;
		switch (i) {
			case MyInner.|
		}
	}
	public static class MyInner {
		final static int VALUEABLE_1 = 1;
	}
}
```

Fixes 1 case, improves a few others so that only
the relevance numbers are wrong.

Signed-off-by: David Thompson <[email protected]>
eg. completion at `_` should not suggest `ExceptionA`

```java
try {
  throw new Exception();
} catch (ExceptionA | _ ) {
  // handle error
}
```

Fix some relevance constants related to this case.

Should fix at least 2 tests.

Signed-off-by: David Thompson <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>
Signed-off-by: Rob Stryker <[email protected]>

Fix many regressions in previously successful tests

Signed-off-by: Rob Stryker <[email protected]>

Fix regression in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2 test0666

Signed-off-by: Rob Stryker <[email protected]>

Fix regressions in completion

Signed-off-by: Rob Stryker <[email protected]>
Version range seems incorrect, I suspect that's the root cause

Signed-off-by: David Thompson <[email protected]>
- Use `$` to separate inner class and outer class in IType key

Signed-off-by: David Thompson <[email protected]>
Reconciling or other routines may receive a CompletionFailure in some
-more or less valid- cases. Instead of letting the exception bubble up
to user land, we simply log it and continue anyway.
- consolidate logic for `CatchClause` into one place
- figure out which types are thrown in the body of the try statement,
  prioritize them
- figure out which types are already caught, deprioritize them
  ("uninteresting bindings")
- handle bug related to classes declared with type declaration statements
  - their bindings are still wrong, so that needs work

Signed-off-by: David Thompson <[email protected]>
eg.
```java
pub|
```

eg.
```java
package test;
import java.util.List;

abst|
```

- Detect that aren't connected to a type declaration using the text content
  of the CU
- Apply the rules regarding which modifiers prevent others from being
  used
- Prevent statement-like keywords in import or package declarations

Signed-off-by: David Thompson <[email protected]>
eg.

```java
switch (i) {
  cas|
}
```

Signed-off-by: David Thompson <[email protected]>
- Add a bunch more statement-like keywords
- Handle completion for `default` in switch statements and expressions

Should fix around 43 cases

Signed-off-by: David Thompson <[email protected]>
- Completion for `new`, `final`, `true`, `false`, and `null` keywords
- Improve logic for checking if only expression-like keywords should be
  suggested
- Prevent default completions in switches without a case label/default
  label

Signed-off-by: David Thompson <[email protected]>
robstryker and others added 2 commits June 18, 2025 15:12
Signed-off-by: Rob Stryker <[email protected]>
This makes the result consistent with what's done with `return`,
but inconsistent with what's done upstream.

Signed-off-by: David Thompson <[email protected]>
@mickaelistria
Copy link
Author

This cause some other issues, this patch needs some more work

This case now works the same as it does upstream:

```java
package dev.datho7561.utils;
/**
 * Outer.Inn|
 */
public class Main {

}
class Outer {
  class Inner {
  }
}
```

There is a bug in jdt.ui which makes it not work in practice though.
It tries to import `Inner`, despite the fact that it's in the same
package and no "additional completion" is provided.

Signed-off-by: David Thompson <[email protected]>
- [x] TODO: test case

Fixes eclipse-jdt#1433

Signed-off-by: David Thompson <[email protected]>
@mickaelistria mickaelistria force-pushed the distinct-parse branch 2 times, most recently from bb4fca8 to dc716e1 Compare June 20, 2025 12:47
@mickaelistria
Copy link
Author

This is supposed to fix a few cases, such as JavaSearchTests.testTypeOccurrences1; but it currently doesn't.

@robstryker robstryker force-pushed the dom-with-javac branch 3 times, most recently from b1b4e0e to 309f390 Compare September 8, 2025 20:48
@robstryker robstryker force-pushed the dom-with-javac branch 2 times, most recently from 5738537 to 9962d57 Compare December 2, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants