Skip to content

Commit

Permalink
Update to TypeScript 2.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-easyesi committed Jun 1, 2018
1 parent e8eb8cf commit 89cb741
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 44 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.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.
The version number of this plugin reflects the version of TypeScript it incorporates (currently 2.9.1), 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
13 changes: 9 additions & 4 deletions 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.7.2"/>
<property name="typescript" value="${env.HOME}/TypeScript-2.9.1"/>
<property name="node.executable" value="node"/>

<target name="compile" depends="projectized-common.compile">
Expand All @@ -35,7 +35,8 @@
<fileset dir="${typescript}/src">
<include name="compiler/**/*.ts"/>
<include name="compiler/diagnosticMessages.json"/>
<include name="services/**/*.ts"/>
<include name="services/**"/>
<include name="tsconfig-base.json"/>
</fileset>
</copy>
<echo file="server/ts/installdir">${typescript}</echo>
Expand All @@ -45,10 +46,14 @@
<patch patchfile="server/ts-patches" strip="0" dir="server/ts" failonerror="true"/>
<echo>Building processDiagnosticMessages.js</echo>
<exec executable="${typescript}/bin/tsc" failonerror="true">
<arg value="${typescript}/scripts/processDiagnosticMessages.ts"/>
<arg value="--project"/>
<arg value="${typescript}/scripts/processDiagnosticMessages.tsconfig.json"/>
<arg value="--outFile"/>
<arg value="build/processDiagnosticMessages.js"/>
<arg value="--noEmitOnError"/>
<arg value="--typeRoots"/>
<arg value="server"/>
<arg value="--types"/>
<arg value="dummy-types"/>
</exec>
<echo>Processing diagnostic messages</echo>
<exec executable="${node.executable}" failonerror="true">
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.7.2.0
OpenIDE-Module-Specification-Version: 2.9.1.0
1 change: 1 addition & 0 deletions server/dummy-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "crypto";
16 changes: 5 additions & 11 deletions server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
* limitations under the License.
*/

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

namespace ts {
// This type is used in services.ts but only declared in shims.ts (a file we don't need)
export type LanguageServiceShimHost = LanguageServiceHost;

export interface Symbol {
nbtsDeprecated?: boolean;
}
Expand Down Expand Up @@ -240,7 +234,7 @@ class Program {
}
getCompletionEntryDetails(fileName: string, position: number, entryName: string) {
if (! this.fileInProject(fileName)) return null;
return this.service.getCompletionEntryDetails(fileName, position, entryName, void 0, void 0);
return this.service.getCompletionEntryDetails(fileName, position, entryName, void 0, void 0, void 0);
}
getCompletionEntryLocation(fileName: string, position: number, entryName: string) {
if (! this.fileInProject(fileName)) return null;
Expand Down Expand Up @@ -614,7 +608,7 @@ class Program {
if (! this.fileInProject(fileName)) return null;
return this.service.getEmitOutput(fileName);
}
getCompilerOptions(fileName: string) {
getCompilerOptions() {
return ts.optionDeclarations.map(function optToJson(opt) {
var res = <any>ts.clone(opt);
if (typeof opt.type === 'object') {
Expand All @@ -628,17 +622,17 @@ class Program {
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[],
formatOptions: ts.FormatCodeSettings) {
if (! this.fileInProject(fileName)) return null;
return this.service.getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions);
return this.service.getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, void 0);
}
getApplicableRefactors(fileName: string, pos: number, end: number) {
if (! this.fileInProject(fileName)) return null;
return this.service.getApplicableRefactors(fileName, pos === end ? pos : { pos, end });
return this.service.getApplicableRefactors(fileName, pos === end ? pos : { pos, end }, void 0);
}
getEditsForRefactor(fileName: string, formatOptions: ts.FormatCodeSettings, pos: number, end: number,
refactorName: string, actionName: string) {
if (! this.fileInProject(fileName)) return null;
return this.service.getEditsForRefactor(fileName, formatOptions, pos === end ? pos : { pos, end },
refactorName, actionName);
refactorName, actionName, void 0);
}
}

Expand Down
34 changes: 11 additions & 23 deletions server/ts-patches
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- services/completions.ts
+++ services/completions.ts
@@ -216,6 +216,7 @@
@@ -239,6 +239,7 @@
kind: SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: SymbolDisplay.getSymbolModifiers(symbol),
sortText: "0",
Expand All @@ -10,30 +10,18 @@
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
--- services/goToDefinition.ts
+++ services/goToDefinition.ts
@@ -60,7 +60,9 @@
const shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol);
const shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return map(shorthandDeclarations,
- declaration => createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
+ // netbeanstypescript edit - node kind is more useful to distinguish the decls
+ //declaration => createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
+ declaration => createDefinitionInfo(declaration, getNodeKind(declaration), shorthandSymbolName, shorthandContainerName));
}

// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
@@ -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
@@ -223,7 +223,7 @@
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
function createDefinitionInfo(declaration: Declaration, checker: TypeChecker, symbol: Symbol, node: Node): DefinitionInfo {
const symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
- const symbolKind = SymbolDisplay.getSymbolKind(checker, symbol, node);
+ const symbolKind = getNodeKind(declaration);
const containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
return createDefinitionInfoFromName(declaration, symbolKind, symbolName, containerName);
}
--- services/types.ts
+++ services/types.ts
@@ -740,6 +740,7 @@
@@ -794,6 +794,7 @@
kind: ScriptElementKind;
kindModifiers: string; // see ScriptElementKindModifier, comma separated
sortText: string;
Expand Down
11 changes: 7 additions & 4 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "./ts/services/tsconfig",
"compilerOptions": {
"noImplicitAny": true,
"noImplicitThis": true,
"declaration": false,
"preserveConstEnums": false,
"removeComments": true,
"target": "es5"
"sourceMap": false,
"typeRoots": ["."],
"types": ["dummy-types"]
},
"files": ["main.ts"]
"include": ["main.ts"]
}

0 comments on commit 89cb741

Please sign in to comment.