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 234149 - no js code-completion for html-canvas object
Summary: no js code-completion for html-canvas object
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 7.3.1
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: suchyond
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-08 20:34 UTC by mknig
Modified: 2016-05-26 08:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (88.96 KB, text/plain)
2013-08-08 20:34 UTC, mknig
Details
Test of the proposed stub (2.51 KB, application/javascript)
2016-03-17 14:51 UTC, suchyond
Details
HTMLCanvasElement and CanvasRenderingContext2D js stubs (9.86 KB, application/x-zip-compressed)
2016-05-03 13:49 UTC, suchyond
Details
Repository patch (14.55 KB, patch)
2016-05-25 15:17 UTC, suchyond
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mknig 2013-08-08 20:34:40 UTC
Product Version = NetBeans IDE 7.3.1 (Build 201306052037)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_21
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.21-b01

HI,
there is no codecompletion for html5-canvas object. I checked the jsstub/*zip and didn´t find any file. Is this a bug

Regards Michael
Comment 1 mknig 2013-08-08 20:34:47 UTC
Created attachment 138461 [details]
IDE log
Comment 2 Petr Pisl 2013-08-13 13:27:54 UTC
Canvas is missing in signatures files. Needs to be added.
Comment 3 colin999 2014-04-10 17:49:10 UTC
Has this been solved? Problem still exists in Netbeans 8. The zip files still doesn't contain reference to canvas.
Comment 4 Martin Fousek 2014-04-11 04:45:21 UTC
(In reply to colin999 from comment #3)
> Has this been solved? Problem still exists in Netbeans 8. The zip files
> still doesn't contain reference to canvas.

Sorry, it's not yet. Targeting to the next release for now.
Comment 5 suchyond 2016-03-17 14:51:49 UTC
Created attachment 158910 [details]
Test of the proposed stub

Hello,
I've missed Canvas support in Nebeans IDE, so I checked the stubs files and started to declare a new one for the Canvas support, i.e. stub_DOM_HTMLCanvasElement

I'm also working on the stub_DOM_CanvasRenderingContext2D.

I've uploaded NON finished - testing version, that I've added this file to NetBeans 8.1\ide\jsstubs and it seems to be working in Netbeans 8.1.

/**@type HTMLCanvasElement*/
var test = document.getElementById('canvas');

JSDoc has to be use as there is no way to detect if getElementById will be a canvas element or it won't.

So my question is if you are OK with this approach? And if it is possible that this patch will be accepted after it's finished.

Thank in advance for your time.
Best Regards
Ondra
Comment 6 Petr Pisl 2016-03-21 10:49:41 UTC
Yes, IMHO this is ok. I don't have problem with this. I can add the patch to the build. Thanks for your help.
Comment 7 suchyond 2016-03-24 08:34:02 UTC
Thanks for your quick reply. I'm working on it :) Final version will be ready in few weeks (2 or 3 weeks I guess) as CanvasRenderingContext2D is quite complex and it will take some time to write the stub and test it.
Comment 8 suchyond 2016-05-03 13:49:39 UTC
Created attachment 159521 [details]
HTMLCanvasElement and CanvasRenderingContext2D js stubs

Hi,
sorry that it took so long. So finally there (domstubs.zip attachment) are new Canvas js stubs files:
js-domstubs\stub_DOM_HTMLCanvasElement.js
js-domstubs\stub_DOM_CanvasRenderingContext2D.js

If somebody wants to use these files as HOT-FIX, just close the IDE, put these two files in following zip archive(following paths are for windows 7 (x64) and Netbeans 8.1):

C:\Users\<Username>\AppData\Roaming\NetBeans\8.1\jsstubs\domstubs.zip
C:\Program Files\NetBeans 8.1\ide\jsstubs\domstubs.zip

and start the IDE again, jsDoc for HTMLCanvasElement and CanvasRenderingContext2D should be working.
You just have to use jsDoc to specify what type your variable has:

/**@type HTMLCanvasElement*/
var canvas = document.getElementById('canvas');

/**@type CanvasRenderingContext2D*/
var context canvas.getContext('2d');

Tested on Netbeans 8.1, on windows 7 (x64).
Comment 9 suchyond 2016-05-25 15:17:14 UTC
Created attachment 159874 [details]
Repository patch

Hi,
I've uploaded archive with new files to http://hg.netbeans.org/binaries
C8F8EC5803B9EA7C482CA2F30A140EB9BF939A97 js-domstubs.zip
I've also attached patch there as an attachment.
The patch links the new js-domstubs file to the repository and contains the data source licence, i.e. licence of Mozilla Developer Network content, that I've used as a source of HTML 5 properties and functions descriptions.

Ondra
Comment 10 Petr Pisl 2016-05-26 08:26:55 UTC
(In reply to suchyond from comment #9)
> Created attachment 159874 [details]
> Repository patch
> 
> Hi,
> I've uploaded archive with new files to http://hg.netbeans.org/binaries
> C8F8EC5803B9EA7C482CA2F30A140EB9BF939A97 js-domstubs.zip
> I've also attached patch there as an attachment.
> The patch links the new js-domstubs file to the repository and contains the
> data source licence, i.e. licence of Mozilla Developer Network content, that
> I've used as a source of HTML 5 properties and functions descriptions.
> 
> Ondra

Thanks Ondra for the patch. I'm just worry about the license. I need to ask for permission. I'm not sure, but NetBeans can not deliver in standard build something under Mozilla License.