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 269179

Summary: PHP spellchecker doesn't work
Product: php Reporter: junichi11
Component: EditorAssignee: junichi11
Status: VERIFIED FIXED    
Severity: normal CC: amobilia, jlahoda, jtulach, tmysik
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: proposed patch
proposed patch v2

Description junichi11 2016-11-30 02:39:06 UTC
From the forum [1].

Steps to reproduce:

1. Check "PHP" of Use in & Set the Default Locale to "en_US" (Tools > Options > Editor > Spellchecker) 
2. Create/Open a PHP file
3. Type a wrong spelled word (e.g. <div>ddd</div>)

Actual result: No underline
Expected result: "ddd" is underlined

It works fine in NetBeans 8.1.

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_111; Java HotSpot(TM) 64-Bit Server VM 25.111-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_111-b14
System: Linux version 4.4.0-47-generic running on amd64; UTF-8;

[1] http://forums.netbeans.org/topic67155.html

Thanks.
Comment 1 junichi11 2016-11-30 05:58:13 UTC
Created attachment 163092 [details]
proposed patch

Tomas, I want to add the spellchecker for PHPDoc comments(spellchecker.bindings.php) to spellchecker.bindings.htmlxml as a friend to use the HtmlTokenList class with the MultiTokenList.create(), and update both spec versions. Could I do that?

Thanks!
Comment 2 Tomas Mysik 2016-11-30 06:38:28 UTC
Unfortunately, the patch _creates_ API of the spellchecker.bindings.htmlxml module (currently, it has no API). Not sure who is the owner of that module, but there should definitely be more work behind this change - probably creating new "api" package only with classes that are supposed to be available to other modules.

But in this particular case, I guess implementation dependency should be fine - both modules are present in the build so there should not be a problem with it.

However, adding Jarda to CC - Jardo, could you please advice?

Thanks.
Comment 3 junichi11 2016-11-30 10:46:21 UTC
(In reply to Tomas Mysik from comment #2)
> Unfortunately, the patch _creates_ API of the spellchecker.bindings.htmlxml
> module (currently, it has no API). Not sure who is the owner of that module,
> but there should definitely be more work behind this change - probably
> creating new "api" package only with classes that are supposed to be
> available to other modules.
> 
> But in this particular case, I guess implementation dependency should be
> fine - both modules are present in the build so there should not be a
> problem with it.

Thanks a lot for your answer! Make sense. My request is bad.

I just changed the module dependency of spellcheker.bindings.htmlxml to implementation version. But I got the error message (Cannot depend on module org.netbeans.modules.spellchecker.bindings.htmlxml using build number as an implementation version).

Thanks.
Comment 4 Jaroslav Tulach 2016-11-30 12:54:05 UTC
Implementation dependency is bad, friend dependency may not be necessary. Why not try the same approach as in spellchecker/src/org/netbeans/modules/spellchecker/ComponentPeer.java - e.g.:

for (TokenListProvider p : MimeLookup.getLookup(MimePath.get("text/html")).lookupAll(TokenListProvider.class)) {
  TokenList l = p.findTokenList(doc);
  if (l != null) {
            List<TokenList> tokens = new ArrayList<>(2);
            tokens.add(new PHPTokenList(doc));
            tokens.add(l); // NOI18N
            return MultiTokenList.create(tokens);
   }
}

that could do the same without any API changes. CCing Jan (author of spellchecker) to verify if my idea is sane.
Comment 5 junichi11 2016-11-30 13:59:46 UTC
Created attachment 163100 [details]
proposed patch v2

(In reply to Jaroslav Tulach from comment #4)
> Why not try the same approach as in
> spellchecker/src/org/netbeans/modules/spellchecker/ComponentPeer.java

It works fine. Thanks a lot!
Comment 6 Tomas Mysik 2016-12-01 07:15:30 UTC
If it works, feel free to apply it :) I will then transplant the fix to the NB 8.2 Patch.

Thanks, guys!
Comment 7 junichi11 2016-12-01 09:55:16 UTC
Applied :)

http://hg.netbeans.org/web-main/rev/5ab2ed9efdb6

Thanks!
Comment 8 Tomas Mysik 2016-12-01 10:43:41 UTC
Thank a lot, Junichi!
Comment 9 junichi11 2016-12-01 10:58:58 UTC
You are welcome :)
Comment 10 Quality Engineering 2016-12-02 02:36:47 UTC
Integrated into 'main-silver', will be available in build *201612020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5ab2ed9efdb6
User: Junichi Yamamoto <junichi11@netbeans.org>
Log: #269179 - PHP spellchecker doesn't work
Comment 11 Tomas Mysik 2016-12-02 07:33:50 UTC
Verified, thanks!

Product Version: NetBeans IDE Dev (Build 20161202-f5e0ed8a8ff8)
Java: 1.8.0_111; Java HotSpot(TM) 64-Bit Server VM 25.111-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_111-b14
System: Linux version 4.8.0-28-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 12 Tomas Mysik 2016-12-03 14:06:02 UTC
Transplanted to the releases repo branch release82:

http://hg.netbeans.org/releases/rev/845ca0fcf2c5

Thanks.
Comment 13 amobilia 2016-12-15 12:06:45 UTC
82patch1-verified