Skip to content

build: update dependency to latest v13 release and fix errors #1516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration/lsp/ivy_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('Angular Ivy language server', () => {
}))!;
expect(response).not.toBeNull();
expect(response.signatures.length).toEqual(1);
expect(response.signatures[0].label).toEqual('toString(): string');
expect(response.signatures[0].label).toEqual('(): string');
});

it('should show signature help with multiple arguments', async () => {
Expand All @@ -203,7 +203,7 @@ describe('Angular Ivy language server', () => {
expect(response).not.toBeNull();
expect(response.signatures.length).toEqual(1);
expect(response.signatures[0].label)
.toEqual('substr(from: number, length?: number | undefined): string');
.toEqual('(from: number, length?: number | undefined): string');
expect(response.signatures[0].parameters).not.toBeUndefined();
expect(response.activeParameter).toBe(1);

Expand Down
3 changes: 2 additions & 1 deletion integration/lsp/viewengine_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {APP_COMPONENT, FOO_TEMPLATE} from '../test_constants';

import {createConnection, initializeServer, openTextDocument} from './test_utils';

describe('Angular language server', () => {
// TODO(atscott): re-enable when we have a solution in place to continue to support View Engine
xdescribe('Angular language server', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; /* 10 seconds */

let client: MessageConnection;
Expand Down
11 changes: 8 additions & 3 deletions integration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../dist/integration",
"rootDirs": ["..", "dist"]
"rootDirs": [
"..",
"dist"
]
},
"references": [
{ "path": "../server/tsconfig.json" }
{
"path": "../server/tsconfig.json"
}
],
"include": [
"test_constants.ts",
"e2e",
"lsp"
]
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
},
"dependencies": {
"@angular/language-service": "13.0.0-next.3",
"@angular/language-service": "13.0.0-next.9",
"typescript": "4.4.3",
"vscode-jsonrpc": "6.0.0",
"vscode-languageclient": "7.0.0",
Expand Down Expand Up @@ -211,4 +211,4 @@
"type": "git",
"url": "https://github.com/angular/vscode-ng-language-service"
}
}
}
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"ngserver": "./bin/ngserver"
},
"dependencies": {
"@angular/language-service": "13.0.0-next.3",
"@angular/language-service": "13.0.0-next.9",
"vscode-jsonrpc": "6.0.0",
"vscode-languageserver": "7.0.0",
"vscode-uri": "3.0.2"
},
"publishConfig": {
"registry": "https://wombat-dressing-room.appspot.com"
}
}
}
7 changes: 4 additions & 3 deletions server/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import {isNgLanguageService, NgLanguageService, PluginConfig} from '@angular/language-service/api';
import * as assert from 'assert';
import * as ts from 'typescript/lib/tsserverlibrary';
import {promisify} from 'util';
import * as lsp from 'vscode-languageserver/node';
Expand Down Expand Up @@ -146,12 +145,14 @@ export class Session {
}
});

// TODO(atscott): The Ivy flag was removed in v13. We need to include a legacy version (some
// v12) of the language service in order to continue supporting view engine.
const pluginConfig: PluginConfig = {
ivy: true,
angularOnly: true,
ivy: options.ivy,
};
if (options.host.isG3) {
assert(options.ivy === true, 'Ivy LS must be used in google3');
options.ivy = true;
pluginConfig.forceStrictTemplates = true;
}
projSvc.configurePlugin({
Expand Down
13 changes: 9 additions & 4 deletions server/src/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/server/tests"
"outDir": "../../../dist/server/tests",
"esModuleInterop": false
},
"references": [
{ "path": "../../tsconfig.json" }
{
"path": "../../tsconfig.json"
}
],
"include": ["*.ts"]
}
"include": [
"*.ts"
]
}
4 changes: 2 additions & 2 deletions server/src/version_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import * as path from 'path';

import {NodeModule, resolve, Version} from '../common/resolver';

const MIN_TS_VERSION = '4.2';
const MIN_NG_VERSION = '12.0';
const MIN_TS_VERSION = '4.3';
const MIN_NG_VERSION = '13.0';
const TSSERVERLIB = 'typescript/lib/tsserverlibrary';

/**
Expand Down
30 changes: 0 additions & 30 deletions syntaxes/test/cases.json

This file was deleted.

27 changes: 27 additions & 0 deletions syntaxes/test/cases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const cases = [
{
'name': 'inline template',
'scopeName': 'inline-template.ng',
'grammarFiles':
['syntaxes/inline-template.json', 'syntaxes/template.json', 'syntaxes/expression.json'],
'testFile': 'syntaxes/test/data/inline-template.ts'
},
{
'name': 'inline styles',
'scopeName': 'inline-styles.ng',
'grammarFiles': ['syntaxes/inline-styles.json'],
'testFile': 'syntaxes/test/data/inline-styles.ts'
},
{
'name': 'template syntax',
'scopeName': 'template.ng',
'grammarFiles': ['syntaxes/template.json', 'syntaxes/expression.json'],
'testFile': 'syntaxes/test/data/template.html'
},
{
'name': 'expression syntax',
'scopeName': 'template.ng',
'grammarFiles': ['syntaxes/template.json', 'syntaxes/expression.json'],
'testFile': 'syntaxes/test/data/expression.html'
}
];
4 changes: 2 additions & 2 deletions syntaxes/test/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'jasmine';
import * as cp from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import * as SNAPSHOT_TEST_CASES from './cases.json';
import {cases} from './cases';

interface TestCase {
name: string;
Expand Down Expand Up @@ -48,7 +48,7 @@ async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Prom
}

describe('snapshot tests', () => {
for (let tc of SNAPSHOT_TEST_CASES) {
for (let tc of cases) {
it(`should work for ${tc.name}`, async () => {
const ec = await snapshotTest(tc);
expect(ec).toBe(0);
Expand Down
17 changes: 12 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"strict": true
"strict": true,
"esModuleInterop": true
},
"files": [],
"references": [
{ "path": "./client" },
{ "path": "./server" },
{ "path": "./syntaxes" }
{
"path": "./client"
},
{
"path": "./server"
},
{
"path": "./syntaxes"
}
]
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
yaml "^1.10.0"
yargs "^17.0.0"

"@angular/[email protected].3":
version "13.0.0-next.3"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.3.tgz#80aa3c0f0c1bfeabb04b11ba1a889461f0979cfc"
integrity sha512-etqLlMX0twVI2lZZhS4Kt3gEOmqq4FiAXEMSmpklJaXqKa4qVUrOqjgkNeAXr3vw/d/Knb4DVn7AQiIUoNNLgg==
"@angular/[email protected].9":
version "13.0.0-next.9"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.9.tgz#4a7ad7b1d703d41354796a918b46555d7e31a497"
integrity sha512-QuxolblOcGFXP/wPBIM4HRZ6HaFtOAGhwy4L5ZMaYGLsPIQ2nSYkicHy2pTiVwxNpXmfwSc80c11XrJTVPqBTQ==

"@babel/code-frame@^7.0.0":
version "7.12.13"
Expand Down