This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | css values completion gets closed while having no space after previous value | ||
---|---|---|---|
Product: | editor | Reporter: | Jindrich Sedek <jsedek> |
Component: | CSL (API & infrastructure) | Assignee: | issues@editor <issues> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | dkonecny, jkovalsky, mfukala |
Priority: | P3 | Keywords: | NETFIX |
Version: | 6.x | ||
Hardware: | Sun | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Patch for excluding comma as a prefix returned by CssCompletion#getPrefix(TokenSequence,int) |
Description
Jindrich Sedek
2008-09-01 16:49:56 UTC
CssCompletion bug. Too late for 65. GsfCompletionProvider.canFilter() bug. On line 388 there is following code: filterPrefix = isJavaIdentifierPart(language, prefix) ? prefix : null; In this issue case the filterPrefix becomes null and then in GCP.filter() the completion windows is just closed if filteredPrefix == null; I do not even understand the logic why canFilter() returns true if the filteredPrefix is null so I better leave the fix on CSL experts. This issue was added to the list of NetFIX [1] candidates. If module owner does not agree, please speak up. Thanks! [1] http://wiki.netbeans.org/NetFIXIssues Created attachment 96625 [details]
Patch for excluding comma as a prefix returned by CssCompletion#getPrefix(TokenSequence,int)
In example [1], the GsfCompletionProvider:388 isJavaIdentifierPart() is called with "c" as the second argument. This makes the variable "filterPrefix" a not empty string, so everything is fine.
However in example [2] ",c" is used. Since comma is not part of any identifier, the variable "filterPrefix" will be null, and the cc window will close.
example [1]:
----------------
h1{
azimuth: behind, |
}
-----------------
invoke cc -> some items appear
pres c to reduce the list
example [2]:
----------------
h1{
azimuth: behind,|
}
-----------------
The reason why ",c" is used is a bit complicated.
The value ",c" is retrieved from the document text using offsets. In example [2] the "anchorOffset" field is one position behind, because it is calculated in GsfCompletionProvider:590 like offset - prefix length. And the prefix is coming from CssCompletion.getPrefix() (line 791) which is the comma itself.
So excluding the comma as a prefix makes both examples work. Also the JUnit tests run without problems. However I'm not 100% sure that this solution has no side effects. Could you please have a look?
http://hg.netbeans.org/jet-main/rev/71a90fc1d2b1 Thanks for the patch! Thanks Vito and especially thanks Gabor for your patch! > In this issue case the filterPrefix becomes null and then in GCP.filter() the
> completion windows is just closed if
> filteredPrefix == null;
>
> I do not even understand the logic why canFilter() returns true if the
> filteredPrefix is null so I better leave the fix
> on CSL experts.
Thanks for the fix in the css editor.
I just want to point out that the problem with canFilter() returning true if filterPrefix == null is still there. The consequence is that the filter() method is then called but fails since the filterPrefix == null. If canFilter() returned false, which is IMHO what it should in such case do, the normal completion query would be run and the results would be returned correctly.
The fix done by Gabor is definitively correct, and since there seems not to be any user impact of the problem above anymore I consider the issue as marginal.
Integrated into 'main-golden', will be available in build *201004090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/71a90fc1d2b1 User: Vita Stejskal <vstejskal@netbeans.org> Log: #145830: applying kapitarg's patch fixing code completion in CSS editor verified. NetBeans IDE Dev (Build 201004270201) |