Netbeans and XP-Framework: phpdoc patch
October 14th, 2010
Following is a patch to get the full auto completion support with the xp framework. I have tested it two days and it works very nice.
Download: Netbeans plugin or diff
# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /Users/seek/Documents/src/netbeans/main-silver # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java --- php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java Base (BASE) +++ php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java Locally Modified (Based On LOCAL) @@ -203,7 +203,7 @@ String[] typeNames = parts[0].split("\\|", 2); List<QualifiedName> types = new ArrayList<QualifiedName>(); for (String tName : typeNames) { + types.add(QualifiedName.create(stripXPFrameworkNS(tName))); } String name = parts[1].split("\\s+", 2)[0]; retval.put(name, types); @@ -226,7 +226,7 @@ if (parts.length > 0) { String type = parts[0].split("\\;", 2)[0]; + return stripXPFrameworkNS(type); } break; @@ -236,6 +236,13 @@ return null; } + private static String stripXPFrameworkNS(String fullname) { + int p = fullname.lastIndexOf('.'); + if (p != -1) { + fullname = fullname.substring(p + 1).trim(); + } + return fullname; + } @CheckForNull static String extractVariableTypeFromAssignment(Assignment assignment, Map<String, AssignmentImpl> allAssignments) { Index: php.editor/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParser.java --- php.editor/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParser.java Base (BASE) +++ php.editor/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParser.java Locally Modified (Based On LOCAL) @@ -183,6 +183,13 @@ docTypes.add(docType); } if (PHPDocVarTypeTags.contains(type)) { + if (description.indexOf('$') == -1) { + String[] tokens = description.split("[ ]+", 2); //NOI18N + if (tokens.length > 1) { + //tokens[1]= "$" + tokens[1]; + description= String.format("%s $%s", tokens[0], tokens[1]); + } + } String variable = getVaribleName(description); if (variable != null) { int startOfVariable = findStartOfDocNode(originalComment, originalCommentStart, variable, start);
Vi IMproved