Bug 574978 - [content assist] keywords are not proposed inside block with subsequent statement
Summary: [content assist] keywords are not proposed inside block with subsequent state...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.21   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 4.21 M3   Edit
Assignee: Stephan Herrmann CLA
QA Contact: Vikas Chandra CLA
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 574913
  Show dependency tree
 
Reported: 2021-07-22 12:00 EDT by Stephan Herrmann CLA
Modified: 2021-08-19 02:55 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2021-07-22 12:00:21 EDT
Given
//---
public class KeywordCompletion {
	void m (String fooo) {
		if (fooo != null) {
			fo
			System.out.println(fooo);
		}
	}
}
//---

fo cannot be completed to the keyword 'for'. Same for other keywords.

This doesn't happen when either the sysout or the enclosing if is removed.

This was discovered in bug 574823, where removing one check in CompletionParser.fetchNextToken() accidentally fixed this issue: remove 
   && this.expressionPtr <= -1
Comment 1 Andrey Loskutov CLA 2021-07-24 03:52:02 EDT
That works fine in I20210723-1800, also fine back to I20210718-1800. 
Are you sure this is not a bug in some older version?
Comment 2 Stephan Herrmann CLA 2021-07-31 15:50:17 EDT
(In reply to Andrey Loskutov from comment #1)
> That works fine in I20210723-1800, also fine back to I20210718-1800. 
> Are you sure this is not a bug in some older version?

"It works" in terms of offering "for" template proposals, but it should also propose the naked keyword "for", which it doesn't.

Please remove the sysout to see what I mean.

Severity set to "minor" anyway ...
Comment 3 Eclipse Genie CLA 2021-08-12 07:45:25 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183953
Comment 5 Stephan Herrmann CLA 2021-08-12 10:17:36 EDT
(In reply to Eclipse Genie from comment #4)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183953 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=43b3339093473b2e9632f287b07b19f344c846fe

Released for 4.21 M3: one more step to treat name references and type references alike, to become less dependent on the whim of syntax recovery.
Comment 6 Manoj N Palat CLA 2021-08-19 02:55:48 EDT
Verified with Eclipse 4.21 M3 Version: 2021-09 (4.21) Build id: I20210818-1800