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.
I am facing this issue while editing Android's XML resources, but I believe that this is just a general issue with XML as NetBeans would handle all the XML files same way. 1. Create an xml file like shown below (img1): -- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:layout_width="fill" /> </RelativeLayout> --- Please note that "fill" value is not valid in the Android resource schema. 2. Now put your text cursor between 'fill' attribute value and the second double quote, and press Ctrl-Space. The editor will autocomplete the attribute with the valid "fill_parent" value, but will not delete "fill" entered before, so you will get "fill_parentfill" instead of expected "fill_parent" (img2). -- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:layout_width="fill_parentfill" /> </RelativeLayout> --- Try to play with different attributes and stuff, but in general it will work same way, keeping the attribute entered before auto completion. The expected behavior is to completely overwrite everything what has been in the attribute value. PS Please consider this issue as a higher priority, because from my personal view the autocomplete functionality for XML attributes is just totally broken. It is much easier currently just to enter valid values manually. If you are using use auto-completion there, you always get wrong replacement and need to take care of watching and fixing it on your own, which doesn't make sense for "auto" completion at all.
Created attachment 146848 [details] Before auto-complete
Created attachment 146849 [details] After auto-complete
Hi; do you use some specific module to assist with Android development ? I am asking since XML completion is schema-driven, and there's (according to https://groups.google.com/forum/#!topic/android-developers/2FtsLQ4wESY) no real schema for the android namespace you use. If you have some XML schema, please attach it here. I've tried to complete in a Spring beans document (with a xml schema) and completion for enumeration-style attributes worked OK: even ambiguous value prefix was correctly overwritten by the completed enum value.
I have no clue about schemas, to be honest. What I can tell you is that the schema does exist, as when you press Ctrl/Cmd-Space, it shows you available options (see 1.png attached). But after selecting one and pressing Enter, the previously written text is not getting replaced, but added at the end of the selected suggestion (see 2.png attached).
Created attachment 148665 [details] auto suggestion
Created attachment 148666 [details] after suggestion selected
(In reply to csbubbles from comment #4) > I have no clue about schemas, to be honest. What I can tell you is that the > schema does exist, as when you press Ctrl/Cmd-Space, it shows you available > options (see 1.png attached). But after selecting one and pressing Enter, > the previously written text is not getting replaced, but added at the end of > the selected suggestion (see 2.png attached). PS 1.png => "auto suggestion", 2.png => "after suggestion selected" I don't think the Android plugin override the default xml editor behavior, so it is expected to work anyway, regardless of how the schema is defined, as it find suggestions for all the attributes somehow.
Created attachment 149194 [details] 1 - create project
Created attachment 149195 [details] 2 - write code
Created attachment 149196 [details] 3 - check autocompletion
Created attachment 149197 [details] 4 - results
This auto-completion issues doesn't seem to be XML editor related, so I have modified the title and the component. You can reproduce it with Java as well following these steps: 1. Create a new Java Application peoject ("1 - create project" png attached) 2. Write some code ("2 - write code" png attached; create two objects AbstractCollection and AbstractList to get both classed in the imports section for the further auto-complete) 3. Place your text cursor between Abstract and Collection words for the AbstractCollection class and press "Cmd+Space" or"Ctrl+Space" on Win/Linux ("3 - check autocompletion" png attached) 4. Select AbstractList from the suggestion popup and press "Return/Enter". [Results] AbstractListCollection [Expected results] AbstractCollection [Impact] Very poor usability. Each time you use auto-complete after you have already entered something, you have to remove manually what is left after. In fact, in most cases it's easier to type manually instead of using the current auto-complete functionality. [Proposed solution] When replacing stuff with autocompletion, remove everything from the current position till the next separation token (space, period, comma, etc.)
Sorry, a typo. The expected result would be "AbstractList" of course, not "AbstractCollection". (In reply to csbubbles from comment #12) > This auto-completion issues doesn't seem to be XML editor related, so I have > modified the title and the component. You can reproduce it with Java as well > following these steps: > > 1. Create a new Java Application peoject ("1 - create project" png attached) > 2. Write some code ("2 - write code" png attached; create two objects > AbstractCollection and AbstractList to get both classed in the imports > section for the further auto-complete) > 3. Place your text cursor between Abstract and Collection words for the > AbstractCollection class and press "Cmd+Space" or"Ctrl+Space" on Win/Linux > ("3 - check autocompletion" png attached) > 4. Select AbstractList from the suggestion popup and press "Return/Enter". > > [Results] > > AbstractListCollection > > [Expected results] > > AbstractCollection > > [Impact] > > Very poor usability. Each time you use auto-complete after you have already > entered something, you have to remove manually what is left after. In fact, > in most cases it's easier to type manually instead of using the current > auto-complete functionality. > > [Proposed solution] > > When replacing stuff with autocompletion, remove everything from the current > position till the next separation token (space, period, comma, etc.)
Please do not different situations in one defect report. Append new information only for the same specific situation, otherwise open a new defect report. The bug described by original part and the part appended at 9/2014 target completely unrelated pieces of code (XML, java completion). Always file a separate report for each found defect, especially in different languages, windows, file types file. Defects are easy to duplicate or link together, but harder to split. Thanks.
Additional note: do not change component after the initial evaluation (we usually move the defect to the correct area during initial eval) unless you *know* where the code that causes or is suspected for the defect is located.
I split the java related part to issue #247097
Hi Svata, From the user perspective there is the only issue - the auto-completion works unexpectedly in the text editor not replacing the wrong term. This is not user's business whether NetBeans has implemented various editors through multiple components and has same bugs in different ones. I believe this is the project manager' and developers' responsibility to analyze the feedback provided by users and create as many tickets as they want for those components they think that would b appropriate. Thanks, Maxim. (In reply to Svata Dedic from comment #14) > Please do not different situations in one defect report. Append new > information only for the same specific situation, otherwise open a new > defect report. > The bug described by original part and the part appended at 9/2014 target > completely unrelated pieces of code (XML, java completion). > > Always file a separate report for each found defect, especially in different > languages, windows, file types file. Defects are easy to duplicate or link > together, but harder to split. Thanks.
This one makes sense, I will follow what you wrote here next time. Thanks. (In reply to Svata Dedic from comment #15) > Additional note: do not change component after the initial evaluation (we > usually move the defect to the correct area during initial eval) unless you > *know* where the code that causes or is suspected for the defect is located.
OK, I reproduced the reported issue with XML completion on Ant files as well. it seems that XML schema-provided enumeration values are OK, but grammar providers have some issue (Android module delivers a special grammar provider for XML completion).
Fixed in jet-main#ac41114f04ae Tested on attribute values, node contents. I hope the fix won't break other providers, the API details are rather underspecified.
Integrated into 'main-silver', will be available in build *201505120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/ac41114f04ae User: Svata Dedic <sdedic@netbeans.org> Log: #243951: attr values wrongly stripped suffix - providers serve full value strings
Created attachment 158315 [details] Use case 1 - Step 1
Created attachment 158316 [details] Use case 1 - Step 2
Created attachment 158317 [details] Use case 1 - Step 3
Created attachment 158318 [details] Use case 2 - Step 1
Created attachment 158319 [details] Use case 2 - Step 2
Created attachment 158320 [details] Use case 2 - Step 3
It's not really fixed, but actually got even worse in 8.1. Please find the 6 new attachment that show 2 use cases - 1) the replacement of an existing attribute value, and 2) entering a new value. This behaves like crazy... In the first case, a new value still doesn't replace the previous one but basically works just like it was explain in the initial bug description - it erases some part from the previous value and keep the other part. In the second case there is some weird merge happening with the next line. Product Version: NetBeans IDE 8.1 (Build 201510222201) Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 System: Mac OS X version 10.11.3 running on x86_64; UTF-8; en_US (nb)
I've tried to create Spring's beans xml file, an attribute's new value doesn't override the old value either. It behaves differently, but instead of replacing the old value with the new one, it simply merges them.
So ... I've fixed a few bugs and will be fixing some more, but no bug in 'core' supports is so fatal as in your usecase #2. It's partially because Android has its own provider of completion items, which may be faulty in some aspects. I will hand off this issue to nbandroid product after I fix inconsistencies in core XML modules.
I suggest that SimpleText in the grammars module returns -1 from getLength(). See issue #249496 and relevant changes.
Integrated into 'main-silver', will be available in build *201607140002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/9b93f2e9263b User: Svata Dedic <sdedic@netbeans.org> Log: #243951: improved consistency between schema-based and Grammar-based completion. Usability improved for schema-based completion