| Summary: | Additional information in content-assist shows up only for types, not for functions | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] JSDT | Reporter: | Jacek Pospychala <jacek.pospychala> | ||||||||||
| Component: | General | Assignee: | Jacek Pospychala <jacek.pospychala> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | cmjaun | ||||||||||
| Version: | 3.2.2 | Flags: | thatnitind:
review+
cmjaun: review+ |
||||||||||
| Target Milestone: | 3.2.3 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 180397 [details]
screenshot
the problem is somewhere in MethodProposalInfo.resolveMember().
Trying to find enclosing type of a method results with null:
javaProject.findType("/p/aa.js") returns null
"/p/aa.js" is the name of file in this case, because methods are declared directly in file.
Created attachment 180405 [details] patch It's caused by changes to bug 316327 Proposed changes in MethodProposalInfo.resolveMember(): 1. construct like below will never enter the loop. So I modified loop a bit. IFunction func = null; for(int i = 0; i < types.length && func != null; ++i) { ... loop... } 2. javaPropect.getTypes(typeName) can return 1-element array with null, when type was not found. In this case it's worth trying also javaProject.findTypeRoot(typeName), so I removed "else". Take a look at this patch guys. Don't we get the same result by fixing the for loop so the condition is "i < types.length && func == null" ? yes, this works as well.
but there's still need to support calling javaProject.findTypeRoot() if javaProject.findTypes() returned IType[1] {null}.
Created attachment 180475 [details]
patch v2
improved patch
btw. probably it's a separate issue that javaProject.findTypes() sometimes returns IType[1] {null}. It should return null instead.
Created attachment 180476 [details]
patch v2 alternative
Different patch, that fixes problem with returned value in javaProject.findTypes(name) and changes "!=" to "==" in MethodProposalInfo.
Nice fix, Jacek, thanks! |
Given following code: /** * Returns the sum of a and b. */ function sum(a, b) { return a + b; } /** * Summarizer * * @constructor */ function Sum() { } After invoking content-assist, for e.g. "su", you should see three proposals: sum(a, b), Sum as type as Sum() function call. Additional information with jsdoc appears only for Sum as type and not for functions.