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.

Bug 253681 - After restart IDE doesn't highlight C++11 keywords in opened files
Summary: After restart IDE doesn't highlight C++11 keywords in opened files
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 8.1
Hardware: PC Solaris
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-23 12:15 UTC by soldatov
Modified: 2016-02-04 18:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack how prepareDocument() is called during file open (4.07 KB, text/plain)
2015-11-03 10:02 UTC, Miloslav Metelka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2015-07-23 12:15:45 UTC
Scenario:
- Create C++ Application project
- Add such code:
int main(int argc, char** argv) {
    int i = 0;
    decltype(i) j = 0;
    return 0;
}
- Copy this code to second file
- Restart IDE
===>
If Start Page is a current tab, then editor can't recognize 'decltype' keyword in both files. If tested file is a current tab, then IDE can recognize this keyword in this file only.
Comment 1 soldatov 2015-07-23 12:22:23 UTC
Other test case:
- Launch IDE
- Push File|Open File...
- Open C++ file with C++11 keywords
==> 'decltype' is black identifier (Bug!!!)
- Close and Open this file again
==> 'decltype' is blue identifier (ok)
Comment 2 Alexander Simon 2015-10-26 14:23:23 UTC
Restoring editor pane does not call CloneableEditorSupport.prepareDocument().
Reassign to evaluation.
Comment 3 Vladimir Voskresensky 2015-11-02 12:51:02 UTC
*** Bug 256285 has been marked as a duplicate of this bug. ***
Comment 4 Miloslav Metelka 2015-11-03 10:02:31 UTC
Created attachment 157115 [details]
Stack how prepareDocument() is called during file open
Comment 5 Miloslav Metelka 2015-11-03 10:06:11 UTC
prepareDocument() is only called from createCloneableTopComponent() (and from adding an annotation). It's definitely not any recent regression so if you want prepareDocument() to be called during component deserialization we must add such functionality.
Comment 6 Alexander Simon 2015-11-03 10:08:14 UTC
(In reply to Miloslav Metelka from comment #4)
> Created attachment 157115 [details]
> Stack how prepareDocument() is called during file open
Bag is about opened in editor after restart documents.
Important step:
- open document, close IDE
- start IDE
IDE restores document in editor pane without calling CloneableEditorSupport.prepareDocument().
Comment 7 Alexander Simon 2015-11-03 10:08:56 UTC
(In reply to Miloslav Metelka from comment #5)
> prepareDocument() is only called from createCloneableTopComponent() (and
> from adding an annotation). It's definitely not any recent regression so if
> you want prepareDocument() to be called during component deserialization we
> must add such functionality.
Why?
Comment 8 Vladimir Voskresensky 2015-11-03 10:26:34 UTC
Mila, you are right. It is old asymmetric behavior which we'd like to make the same.
We use prepareDocument to set up out of EDT some important settings which changes behavior of Lexer (i.e. set up which IDs are keywords and what is C++ flavor of document).
Comment 9 Alexander Simon 2015-11-03 10:47:21 UTC
Another suspicious behavior.
Restart IDE with opened "start page" and c++ file.
IDE open start page, switch on c++ file. See bug (prepareDocument was not called).
Restart IDE with opened c++ file.
IDE open c++ file. There is no bug (prepareDocument was called).
Comment 10 Miloslav Metelka 2015-11-10 09:42:35 UTC
Added CES.prepareDocument() into component intialization phase.
http://hg.netbeans.org/jet-main/rev/61eb9d155ec7

Please note that CES.prepareDocument() may be called many times (e.g. when adding an annotation).
Comment 11 Vladimir Voskresensky 2015-11-10 11:44:10 UTC
Let's test in trunk and then backport to 8.1 patch (platform for OSS.Next)
Comment 12 Quality Engineering 2015-11-11 02:32:38 UTC
Integrated into 'main-silver', will be available in build *201511110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/61eb9d155ec7
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #253681 - After restart IDE doesn't highlight C++11 keywords in opened files - CES.prepareDocument() called for deserialized components.
Comment 13 Alexander Simon 2015-11-13 07:06:12 UTC
Thanks, it works.
Comment 14 Vladimir Voskresensky 2015-11-24 16:44:06 UTC
Ilia will transplant this one for studio into release81
Comment 15 Jiri Kovalsky 2016-02-04 13:45:05 UTC
Changeset from releases repository please? Thanks!
Comment 16 Alexander Simon 2016-02-04 14:55:11 UTC
changeset:   304948:6d58b9ef6748
branch:      release81
user:        Miloslav Metelka <mmetelka@netbeans.org>
date:        Tue Nov 10 10:41:22 2015 +0100
summary:     #253681 - After restart IDE doesn't highlight C++11 keywords in opened files - CES.prepareDocument() called for deserialized components.
Comment 17 soldatov 2016-02-04 18:34:06 UTC
Verified in NetBeans 8.1 patch1

1st scenario has been fixed
2nd scenario should be investigated in issue 257832