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 135167 - Braces matching (MasterMatcher) doesn't work anymore for non-Lexer kits
Summary: Braces matching (MasterMatcher) doesn't work anymore for non-Lexer kits
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: SIMPLEFIX
Depends on:
Blocks:
 
Reported: 2008-05-15 17:25 UTC by emi
Modified: 2008-06-07 16:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2008-05-15 17:25:21 UTC
MasterMatcher.findFactories(...) compares TokenHierarchy.get(document) with null but TokenHierarchy.get(document) is
never null anymore (just look at the call chain, it will always return a valid object with the current codebase).

This breaks braces matching for non-Lexer kits as TokenHierarchy.get(document) returns non-null but 
th.embeddedTokenSequences(offset, backward).isEmpty()==true and thus no factory is returned.

The check should probably be:
     if (th.isActive()) {
         List<TokenSequence<?>> sequences = th.embeddedTokenSequences(offset, backward);
     ...

This seems to fix the bug, ie. braces matching works again for my editor. I'm not entirely certain it is correct, but
.isActive() seems to be used by org.netbeans.modules.editor.impl.highlighting.HLFactory to check for a lexer kit.
Comment 1 Vitezslav Stejskal 2008-05-19 10:19:40 UTC
I see, I'll fix it. I think your fix is correct. IIRC the lexer behavior was changed some time ago and we went through
the codebase and changed it. This must have slipped through somehow, sorry.
Comment 2 Vitezslav Stejskal 2008-06-07 10:01:39 UTC
http://hg.netbeans.org/main/rev/8fa62a739a0a
Comment 3 Quality Engineering 2008-06-07 16:10:26 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #243 build
Changeset: http://hg.netbeans.org/main/rev/8fa62a739a0a
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #135167 (fixed): proper check for lexerified languages