Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit cc46c6f

Browse files
Upgrade to TypeScript 4.7 (#394)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 144d1f0 commit cc46c6f

File tree

10 files changed

+118
-44
lines changed

10 files changed

+118
-44
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@
4444
"rollup": "^2.75.4",
4545
"rollup-plugin-typescript2": "^0.31.2",
4646
"ts-jest": "^26.5.6",
47-
"typescript": "^4.3.5",
47+
"typescript": "^4.7.2",
4848
"vscode-languageserver-protocol": "^3.16.0",
4949
"vscode-languageserver-types": "^3.17.1"
50-
},
51-
"resolutions": {
52-
"tslib": "^2.1.0"
5350
}
5451
}

src/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe("test suite", () => {
199199
},
200200
{
201201
initializationOptions: { preferences: "user preferences" },
202-
syntaxes: ["typescript", "tsx", "javascript", "jsx"],
202+
syntaxes: ["typescript", "tsx", "cts", "mts", "javascript", "jsx"],
203203
}
204204
);
205205
const languageClient: LanguageClient =

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async function asyncActivate() {
147147
};
148148
}
149149

150-
const syntaxes = ["typescript", "tsx"];
150+
const syntaxes = ["typescript", "tsx", "cts", "mts"];
151151
if (isEnabledForJavascript()) {
152152
syntaxes.push("javascript", "jsx");
153153
}

src/novaUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function wrapCommand(
77
try {
88
await command(...args);
99
} catch (err) {
10-
nova.workspace.showErrorMessage(err);
10+
nova.workspace.showErrorMessage((err as Error).message);
1111
}
1212
};
1313
}

src/tsUserPreferences.test.ts

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ describe("tsUserPreferences", () => {
2828

2929
setupUserPreferences();
3030

31-
expect(nova.config.onDidChange).toBeCalledTimes(17);
32-
expect(nova.workspace.config.onDidChange).toBeCalledTimes(17);
31+
expect(nova.config.onDidChange).toBeCalledTimes(29);
32+
expect(nova.workspace.config.onDidChange).toBeCalledTimes(29);
3333

3434
const globalConfigKeys = (
3535
nova.config.onDidChange as jest.Mock
@@ -40,23 +40,35 @@ describe("tsUserPreferences", () => {
4040
expect(globalConfigKeys).toEqual(workspaceConfigKeys);
4141
expect(globalConfigKeys).toMatchInlineSnapshot(`
4242
Array [
43+
"apexskier.typescript.config.userPreferences.allowIncompleteCompletions",
44+
"apexskier.typescript.config.userPreferences.allowRenameOfImportPath",
45+
"apexskier.typescript.config.userPreferences.allowTextChangesInNewFiles",
4346
"apexskier.typescript.config.userPreferences.disableSuggestions",
44-
"apexskier.typescript.config.userPreferences.quotePreference",
45-
"apexskier.typescript.config.userPreferences.includeCompletionsForModuleExports",
47+
"apexskier.typescript.config.userPreferences.displayPartsForJSDoc",
48+
"apexskier.typescript.config.userPreferences.generateReturnInDocTemplate",
49+
"apexskier.typescript.config.userPreferences.importModuleSpecifierEnding",
50+
"apexskier.typescript.config.userPreferences.importModuleSpecifierPreference",
51+
"apexskier.typescript.config.userPreferences.includeAutomaticOptionalChainCompletions",
4652
"apexskier.typescript.config.userPreferences.includeCompletionsForImportStatements",
47-
"apexskier.typescript.config.userPreferences.includeCompletionsWithSnippetText",
53+
"apexskier.typescript.config.userPreferences.includeCompletionsForModuleExports",
54+
"apexskier.typescript.config.userPreferences.includeCompletionsWithClassMemberSnippets",
4855
"apexskier.typescript.config.userPreferences.includeCompletionsWithInsertText",
49-
"apexskier.typescript.config.userPreferences.includeAutomaticOptionalChainCompletions",
50-
"apexskier.typescript.config.userPreferences.importModuleSpecifierPreference",
51-
"apexskier.typescript.config.userPreferences.importModuleSpecifierEnding",
52-
"apexskier.typescript.config.userPreferences.allowTextChangesInNewFiles",
56+
"apexskier.typescript.config.userPreferences.includeCompletionsWithObjectLiteralMethodSnippets",
57+
"apexskier.typescript.config.userPreferences.includeCompletionsWithSnippetText",
58+
"apexskier.typescript.config.userPreferences.includeInlayEnumMemberValueHints",
59+
"apexskier.typescript.config.userPreferences.includeInlayFunctionLikeReturnTypeHints",
60+
"apexskier.typescript.config.userPreferences.includeInlayFunctionParameterTypeHints",
61+
"apexskier.typescript.config.userPreferences.includeInlayParameterNameHints",
62+
"apexskier.typescript.config.userPreferences.includeInlayParameterNameHintsWhenArgumentMatchesName",
63+
"apexskier.typescript.config.userPreferences.includeInlayPropertyDeclarationTypeHints",
64+
"apexskier.typescript.config.userPreferences.includeInlayVariableTypeHints",
65+
"apexskier.typescript.config.userPreferences.includePackageJsonAutoImports",
66+
"apexskier.typescript.config.userPreferences.jsxAttributeCompletionStyle",
5367
"apexskier.typescript.config.userPreferences.lazyConfiguredProjectsFromExternalProject",
5468
"apexskier.typescript.config.userPreferences.providePrefixAndSuffixTextForRename",
5569
"apexskier.typescript.config.userPreferences.provideRefactorNotApplicableReason",
56-
"apexskier.typescript.config.userPreferences.allowRenameOfImportPath",
57-
"apexskier.typescript.config.userPreferences.includePackageJsonAutoImports",
58-
"apexskier.typescript.config.userPreferences.displayPartsForJSDoc",
59-
"apexskier.typescript.config.userPreferences.generateReturnInDocTemplate",
70+
"apexskier.typescript.config.userPreferences.quotePreference",
71+
"apexskier.typescript.config.userPreferences.useLabelDetailsInCompletionEntries",
6072
]
6173
`);
6274

@@ -92,6 +104,7 @@ describe("tsUserPreferences", () => {
92104
);
93105
expect(getUserPreferences()).toMatchInlineSnapshot(`
94106
Object {
107+
"allowIncompleteCompletions": "global apexskier.typescript.config.userPreferences.allowIncompleteCompletions boolean",
95108
"allowRenameOfImportPath": "global apexskier.typescript.config.userPreferences.allowRenameOfImportPath boolean",
96109
"allowTextChangesInNewFiles": "global apexskier.typescript.config.userPreferences.allowTextChangesInNewFiles boolean",
97110
"disableSuggestions": "global apexskier.typescript.config.userPreferences.disableSuggestions boolean",
@@ -102,13 +115,24 @@ describe("tsUserPreferences", () => {
102115
"includeAutomaticOptionalChainCompletions": "global apexskier.typescript.config.userPreferences.includeAutomaticOptionalChainCompletions boolean",
103116
"includeCompletionsForImportStatements": "global apexskier.typescript.config.userPreferences.includeCompletionsForImportStatements boolean",
104117
"includeCompletionsForModuleExports": "global apexskier.typescript.config.userPreferences.includeCompletionsForModuleExports boolean",
118+
"includeCompletionsWithClassMemberSnippets": "global apexskier.typescript.config.userPreferences.includeCompletionsWithClassMemberSnippets boolean",
105119
"includeCompletionsWithInsertText": "global apexskier.typescript.config.userPreferences.includeCompletionsWithInsertText boolean",
120+
"includeCompletionsWithObjectLiteralMethodSnippets": "global apexskier.typescript.config.userPreferences.includeCompletionsWithObjectLiteralMethodSnippets boolean",
106121
"includeCompletionsWithSnippetText": "global apexskier.typescript.config.userPreferences.includeCompletionsWithSnippetText boolean",
122+
"includeInlayEnumMemberValueHints": "global apexskier.typescript.config.userPreferences.includeInlayEnumMemberValueHints boolean",
123+
"includeInlayFunctionLikeReturnTypeHints": "global apexskier.typescript.config.userPreferences.includeInlayFunctionLikeReturnTypeHints boolean",
124+
"includeInlayFunctionParameterTypeHints": "global apexskier.typescript.config.userPreferences.includeInlayFunctionParameterTypeHints boolean",
125+
"includeInlayParameterNameHints": "global apexskier.typescript.config.userPreferences.includeInlayParameterNameHints string",
126+
"includeInlayParameterNameHintsWhenArgumentMatchesName": "global apexskier.typescript.config.userPreferences.includeInlayParameterNameHintsWhenArgumentMatchesName boolean",
127+
"includeInlayPropertyDeclarationTypeHints": "global apexskier.typescript.config.userPreferences.includeInlayPropertyDeclarationTypeHints boolean",
128+
"includeInlayVariableTypeHints": "global apexskier.typescript.config.userPreferences.includeInlayVariableTypeHints boolean",
107129
"includePackageJsonAutoImports": "global apexskier.typescript.config.userPreferences.includePackageJsonAutoImports string",
130+
"jsxAttributeCompletionStyle": "global apexskier.typescript.config.userPreferences.jsxAttributeCompletionStyle string",
108131
"lazyConfiguredProjectsFromExternalProject": "global apexskier.typescript.config.userPreferences.lazyConfiguredProjectsFromExternalProject boolean",
109132
"providePrefixAndSuffixTextForRename": "global apexskier.typescript.config.userPreferences.providePrefixAndSuffixTextForRename boolean",
110133
"provideRefactorNotApplicableReason": "global apexskier.typescript.config.userPreferences.provideRefactorNotApplicableReason boolean",
111134
"quotePreference": "global apexskier.typescript.config.userPreferences.quotePreference string",
135+
"useLabelDetailsInCompletionEntries": "global apexskier.typescript.config.userPreferences.useLabelDetailsInCompletionEntries boolean",
112136
}
113137
`);
114138
});
@@ -122,6 +146,7 @@ describe("tsUserPreferences", () => {
122146
);
123147
expect(getUserPreferences()).toMatchInlineSnapshot(`
124148
Object {
149+
"allowIncompleteCompletions": "workspace apexskier.typescript.config.userPreferences.allowIncompleteCompletions boolean",
125150
"allowRenameOfImportPath": "workspace apexskier.typescript.config.userPreferences.allowRenameOfImportPath boolean",
126151
"allowTextChangesInNewFiles": "workspace apexskier.typescript.config.userPreferences.allowTextChangesInNewFiles boolean",
127152
"disableSuggestions": "workspace apexskier.typescript.config.userPreferences.disableSuggestions boolean",
@@ -132,13 +157,24 @@ describe("tsUserPreferences", () => {
132157
"includeAutomaticOptionalChainCompletions": "workspace apexskier.typescript.config.userPreferences.includeAutomaticOptionalChainCompletions boolean",
133158
"includeCompletionsForImportStatements": "workspace apexskier.typescript.config.userPreferences.includeCompletionsForImportStatements boolean",
134159
"includeCompletionsForModuleExports": "workspace apexskier.typescript.config.userPreferences.includeCompletionsForModuleExports boolean",
160+
"includeCompletionsWithClassMemberSnippets": "workspace apexskier.typescript.config.userPreferences.includeCompletionsWithClassMemberSnippets boolean",
135161
"includeCompletionsWithInsertText": "workspace apexskier.typescript.config.userPreferences.includeCompletionsWithInsertText boolean",
162+
"includeCompletionsWithObjectLiteralMethodSnippets": "workspace apexskier.typescript.config.userPreferences.includeCompletionsWithObjectLiteralMethodSnippets boolean",
136163
"includeCompletionsWithSnippetText": "workspace apexskier.typescript.config.userPreferences.includeCompletionsWithSnippetText boolean",
164+
"includeInlayEnumMemberValueHints": "workspace apexskier.typescript.config.userPreferences.includeInlayEnumMemberValueHints boolean",
165+
"includeInlayFunctionLikeReturnTypeHints": "workspace apexskier.typescript.config.userPreferences.includeInlayFunctionLikeReturnTypeHints boolean",
166+
"includeInlayFunctionParameterTypeHints": "workspace apexskier.typescript.config.userPreferences.includeInlayFunctionParameterTypeHints boolean",
167+
"includeInlayParameterNameHints": "workspace apexskier.typescript.config.userPreferences.includeInlayParameterNameHints string",
168+
"includeInlayParameterNameHintsWhenArgumentMatchesName": "workspace apexskier.typescript.config.userPreferences.includeInlayParameterNameHintsWhenArgumentMatchesName boolean",
169+
"includeInlayPropertyDeclarationTypeHints": "workspace apexskier.typescript.config.userPreferences.includeInlayPropertyDeclarationTypeHints boolean",
170+
"includeInlayVariableTypeHints": "workspace apexskier.typescript.config.userPreferences.includeInlayVariableTypeHints boolean",
137171
"includePackageJsonAutoImports": "workspace apexskier.typescript.config.userPreferences.includePackageJsonAutoImports string",
172+
"jsxAttributeCompletionStyle": "workspace apexskier.typescript.config.userPreferences.jsxAttributeCompletionStyle string",
138173
"lazyConfiguredProjectsFromExternalProject": "workspace apexskier.typescript.config.userPreferences.lazyConfiguredProjectsFromExternalProject boolean",
139174
"providePrefixAndSuffixTextForRename": "workspace apexskier.typescript.config.userPreferences.providePrefixAndSuffixTextForRename boolean",
140175
"provideRefactorNotApplicableReason": "workspace apexskier.typescript.config.userPreferences.provideRefactorNotApplicableReason boolean",
141176
"quotePreference": "workspace apexskier.typescript.config.userPreferences.quotePreference string",
177+
"useLabelDetailsInCompletionEntries": "workspace apexskier.typescript.config.userPreferences.useLabelDetailsInCompletionEntries boolean",
142178
}
143179
`);
144180
});

src/tsUserPreferences.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,35 @@ const keys: {
1515
: never;
1616
} &
1717
Record<keyof UserPreferences, string> = {
18+
allowIncompleteCompletions: "boolean",
19+
allowRenameOfImportPath: "boolean",
20+
allowTextChangesInNewFiles: "boolean",
1821
disableSuggestions: "boolean",
19-
quotePreference: "string",
20-
includeCompletionsForModuleExports: "boolean",
22+
displayPartsForJSDoc: "boolean",
23+
generateReturnInDocTemplate: "boolean",
24+
importModuleSpecifierEnding: "string",
25+
importModuleSpecifierPreference: "string",
26+
includeAutomaticOptionalChainCompletions: "boolean",
2127
includeCompletionsForImportStatements: "boolean",
22-
includeCompletionsWithSnippetText: "boolean",
28+
includeCompletionsForModuleExports: "boolean",
29+
includeCompletionsWithClassMemberSnippets: "boolean",
2330
includeCompletionsWithInsertText: "boolean",
24-
includeAutomaticOptionalChainCompletions: "boolean",
25-
importModuleSpecifierPreference: "string",
26-
importModuleSpecifierEnding: "string",
27-
allowTextChangesInNewFiles: "boolean",
31+
includeCompletionsWithObjectLiteralMethodSnippets: "boolean",
32+
includeCompletionsWithSnippetText: "boolean",
33+
includeInlayEnumMemberValueHints: "boolean",
34+
includeInlayFunctionLikeReturnTypeHints: "boolean",
35+
includeInlayFunctionParameterTypeHints: "boolean",
36+
includeInlayParameterNameHints: "string",
37+
includeInlayParameterNameHintsWhenArgumentMatchesName: "boolean",
38+
includeInlayPropertyDeclarationTypeHints: "boolean",
39+
includeInlayVariableTypeHints: "boolean",
40+
includePackageJsonAutoImports: "string",
41+
jsxAttributeCompletionStyle: "string",
2842
lazyConfiguredProjectsFromExternalProject: "boolean",
2943
providePrefixAndSuffixTextForRename: "boolean",
3044
provideRefactorNotApplicableReason: "boolean",
31-
allowRenameOfImportPath: "boolean",
32-
includePackageJsonAutoImports: "string",
33-
displayPartsForJSDoc: "boolean",
34-
generateReturnInDocTemplate: "boolean",
45+
quotePreference: "string",
46+
useLabelDetailsInCompletionEntries: "boolean",
3547
};
3648

3749
export function setupUserPreferences(): Disposable {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<syntax name="typescript-cts">
3+
<meta>
4+
<name>TypeScript (CommonJS module)</name>
5+
<type>script</type>
6+
<preferred-file-extension>cts</preferred-file-extension>
7+
<parent>typescript</parent>
8+
<detectors>
9+
<extension priority="1.0">cts,d.cts</extension>
10+
</detectors>
11+
</meta>
12+
</syntax>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<syntax name="typescript-mts">
3+
<meta>
4+
<name>TypeScript (ES module)</name>
5+
<type>script</type>
6+
<preferred-file-extension>mts</preferred-file-extension>
7+
<parent>typescript</parent>
8+
<detectors>
9+
<extension priority="1.0">mts,d.mts</extension>
10+
</detectors>
11+
</meta>
12+
</syntax>

typescript.novaextension/extension.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,35 +449,35 @@
449449
"title": "Find References",
450450
"command": "apexskier.typescript.findReferences",
451451
"filters": {
452-
"syntaxes": ["typescript", "tsx", "javascript", "jsx"]
452+
"syntaxes": ["typescript", "tsx", "javascript", "jsx", "cts", "mts"]
453453
}
454454
},
455455
{
456456
"title": "Rename Symbol",
457457
"command": "apexskier.typescript.rename",
458458
"filters": {
459-
"syntaxes": ["typescript", "tsx", "javascript", "jsx"]
459+
"syntaxes": ["typescript", "tsx", "javascript", "jsx", "cts", "mts"]
460460
}
461461
},
462462
{
463463
"title": "Organize Imports",
464464
"command": "apexskier.typescript.commands.organizeImports",
465465
"filters": {
466-
"syntaxes": ["typescript", "tsx", "javascript", "jsx"]
466+
"syntaxes": ["typescript", "tsx", "javascript", "jsx", "cts", "mts"]
467467
}
468468
},
469469
{
470470
"title": "Format Document",
471471
"command": "apexskier.typescript.commands.formatDocument",
472472
"filters": {
473-
"syntaxes": ["typescript", "tsx", "javascript", "jsx"]
473+
"syntaxes": ["typescript", "tsx", "javascript", "jsx", "cts", "mts"]
474474
}
475475
},
476476
{
477477
"title": "Show Documentation (experimental)",
478478
"command": "apexskier.typescript.signatureHelp",
479479
"filters": {
480-
"syntaxes": ["typescript", "tsx", "javascript", "jsx"]
480+
"syntaxes": ["typescript", "tsx", "javascript", "jsx", "cts", "mts"]
481481
}
482482
}
483483
]

yarn.lock

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4293,10 +4293,15 @@ ts-jest@^26.5.6:
42934293
semver "7.x"
42944294
yargs-parser "20.x"
42954295

4296-
tslib@^1.8.1, tslib@^1.9.0, tslib@^2.1.0, tslib@^2.3.1:
4297-
version "2.2.0"
4298-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
4299-
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
4296+
tslib@^1.8.1, tslib@^1.9.0:
4297+
version "1.14.1"
4298+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
4299+
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
4300+
4301+
tslib@^2.3.1:
4302+
version "2.4.0"
4303+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
4304+
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
43004305

43014306
tsutils@^3.21.0:
43024307
version "3.21.0"
@@ -4363,10 +4368,10 @@ typedarray-to-buffer@^3.1.5:
43634368
dependencies:
43644369
is-typedarray "^1.0.0"
43654370

4366-
typescript@^4.3.5:
4367-
version "4.3.5"
4368-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
4369-
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
4371+
typescript@^4.7.2:
4372+
version "4.7.2"
4373+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4"
4374+
integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==
43704375

43714376
union-value@^1.0.0:
43724377
version "1.0.1"

0 commit comments

Comments
 (0)