Skip to content

Commit

Permalink
Update to TypeScript 2.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-easyesi committed Feb 23, 2018
1 parent 8e66c57 commit fc54734
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Download the latest netbeanstypescript.nbm file from the [Releases](https://gith

### Versioning

The version number of this plugin reflects the version of TypeScript it incorporates (currently 2.5.3), with an extra digit for new versions that do not involve a TypeScript update. We intend to keep this plugin up to date with new versions of TypeScript when they come out.
The version number of this plugin reflects the version of TypeScript it incorporates (currently 2.7.2), with an extra digit for new versions that do not involve a TypeScript update. We intend to keep this plugin up to date with new versions of TypeScript when they come out.

### Contributing

Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- Paths to the TypeScript installation to copy files from, and the Node.js executable to
use while building. Adjust these according to your own environment. -->
<property name="typescript" value="${env.HOME}/TypeScript-2.5.3"/>
<property name="typescript" value="${env.HOME}/TypeScript-2.7.2"/>
<property name="node.executable" value="node"/>

<target name="compile" depends="projectized-common.compile">
Expand Down
2 changes: 1 addition & 1 deletion manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ AutoUpdate-Show-In-Client: true
OpenIDE-Module: netbeanstypescript
OpenIDE-Module-Layer: netbeanstypescript/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: netbeanstypescript/Bundle.properties
OpenIDE-Module-Specification-Version: 2.5.3.0
OpenIDE-Module-Specification-Version: 2.7.2.0
7 changes: 4 additions & 3 deletions server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

/// <reference path="ts/compiler/builderState.ts"/>
/// <reference path="ts/services/services.ts"/>

namespace ts {
Expand Down Expand Up @@ -235,15 +236,15 @@ class Program {
}
getCompletions(fileName: string, position: number) {
if (! this.fileInProject(fileName)) return null;
return this.service.getCompletionsAtPosition(fileName, position);
return this.service.getCompletionsAtPosition(fileName, position, void 0);
}
getCompletionEntryDetails(fileName: string, position: number, entryName: string) {
if (! this.fileInProject(fileName)) return null;
return this.service.getCompletionEntryDetails(fileName, position, entryName);
return this.service.getCompletionEntryDetails(fileName, position, entryName, void 0, void 0);
}
getCompletionEntryLocation(fileName: string, position: number, entryName: string) {
if (! this.fileInProject(fileName)) return null;
var sym = this.service.getCompletionEntrySymbol(fileName, position, entryName);
var sym = this.service.getCompletionEntrySymbol(fileName, position, entryName, void 0);
if (sym) {
var decl = sym.declarations[0];
if (decl) {
Expand Down
39 changes: 19 additions & 20 deletions server/ts-patches
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
--- services/completions.ts
+++ services/completions.ts
@@ -131,6 +131,7 @@
@@ -216,6 +216,7 @@
kind: SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: SymbolDisplay.getSymbolModifiers(symbol),
sortText: "0",
+ type: typeChecker.typeToString(typeChecker.getTypeOfSymbolAtLocation(symbol, location))
};
}

+ type: typeChecker.typeToString(typeChecker.getTypeOfSymbolAtLocation(symbol, location)),
source: getSourceFromOrigin(origin),
hasAction: trueOrUndefined(!!origin && origin.type === "export"),
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
--- services/goToDefinition.ts
+++ services/goToDefinition.ts
@@ -73,7 +73,9 @@
@@ -60,7 +60,9 @@
const shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol);
const shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return map(shorthandDeclarations,
Expand All @@ -21,24 +21,23 @@
}

// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
@@ -181,7 +183,9 @@
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
// Just add all the declarations.
forEach(declarations, declaration => {
- result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
+ // netbeanstypescript edit - node kind is more useful to distinguish the decls
+ //result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
+ result.push(createDefinitionInfo(declaration, getNodeKind(declaration), symbolName, containerName));
});
}
@@ -186,7 +188,8 @@

function getDefinitionFromSymbol(typeChecker: TypeChecker, symbol: Symbol, node: Node): DefinitionInfo[] {
const { symbolName, symbolKind, containerName } = getSymbolInfo(typeChecker, symbol, node);
- return getConstructSignatureDefinition() || getCallSignatureDefinition() || map(symbol.declarations, declaration => createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
+ // netbeanstypescript edit - node kind is more useful to distinguish the decls
+ return getConstructSignatureDefinition() || getCallSignatureDefinition() || map(symbol.declarations, declaration => createDefinitionInfo(declaration, getNodeKind(declaration), symbolName, containerName));

function getConstructSignatureDefinition(): DefinitionInfo[] | undefined {
// Applicable only if we are in a new expression, or we are on a constructor declaration
--- services/types.ts
+++ services/types.ts
@@ -657,6 +657,7 @@
@@ -740,6 +740,7 @@
kind: ScriptElementKind;
kindModifiers: string; // see ScriptElementKindModifier, comma separated
kindModifiers: string; // see ScriptElementKindModifier, comma separated
sortText: string;
+ type?: string;
insertText?: string;
/**
* An optional span that indicates the text to be replaced by this completion item. It will be
* set if the required span differs from the one generated by the default replacement behavior and should
* An optional span that indicates the text to be replaced by this completion item.
10 changes: 7 additions & 3 deletions src/netbeanstypescript/TSNameKindModifiers.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ public class TSNameKindModifiers {
TSNameKindModifiers(JSONObject obj) {
name = (String) obj.get("name");

// See ScriptElementKind in services/services.ts
// See ScriptElementKind in services/types.ts
switch ((String) obj.get("kind")) {
case "warning": break;
case "keyword": kind = ElementKind.KEYWORD; break;
case "script": kind = ElementKind.FILE; break;
case "module": kind = ElementKind.MODULE; break;
case "class": kind = ElementKind.CLASS; break;
case "class": case "local class": kind = ElementKind.CLASS; break;
case "interface": case "type": kind = ElementKind.INTERFACE; icon = interfaceIcon; break;
case "enum": kind = ElementKind.CLASS; icon = enumIcon; break;
case "enum member": kind = ElementKind.PARAMETER; break;
case "var": kind = ElementKind.VARIABLE; break;
case "local var": kind = ElementKind.VARIABLE; break;
case "function": kind = ElementKind.METHOD; break;
Expand All @@ -96,10 +98,11 @@ public class TSNameKindModifiers {
case "let": kind = ElementKind.VARIABLE; break;
case "directory": kind = ElementKind.PACKAGE; icon = folderIcon; break;
case "external module name": kind = ElementKind.MODULE; break;
case "JSX attribute": break;
default: TSService.log.log(Level.WARNING, "Unknown symbol kind [{0}]", obj.get("kind"));
}

// See ScriptElementKindModifier in services/services.ts
// See ScriptElementKindModifier in services/types.ts
String kindModifiers = (String) obj.get("kindModifiers");
if (kindModifiers != null && ! kindModifiers.isEmpty()) {
modifiers = EnumSet.noneOf(Modifier.class);
Expand All @@ -112,6 +115,7 @@ public class TSNameKindModifiers {
case "declare": break;
case "static": modifiers.add(Modifier.STATIC); break;
case "abstract": modifiers.add(Modifier.ABSTRACT); break;
case "optional": break;
case "deprecated": modifiers.add(Modifier.DEPRECATED); break;
default: TSService.log.log(Level.WARNING, "Unknown modifier [{0}]", modifier);
}
Expand Down
2 changes: 1 addition & 1 deletion src/netbeanstypescript/api/lexer/TSLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public Token<JsTokenId> nextToken() {
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
do {
ch = input.read();
} while (Character.isLetterOrDigit(ch));
} while (Character.isJavaIdentifierPart(ch));
// TODO: hex/octal literals can't have decimals
if (ch == '.') {
return decimal();
Expand Down

0 comments on commit fc54734

Please sign in to comment.