Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=974837034
pnpm-lock.yaml=1558677558
yarn.lock=1032887011
package.json=-54516055
pnpm-lock.yaml=-1935999358
yarn.lock=245760933
package.json=2019393865
pnpm-workspace.yaml=1711114604
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ integration/project/node_modules/
integration/project/libs/post/node_modules
integration/project/dist/
integration/workspace/node_modules/
integration/pre_standalone_project/node_modules/

override_rename_ts_plugin/node_modules
server/node_modules
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- node/install-packages:
app-dir: integration/pre_apf_project
pkg-manager: yarn
- node/install-packages:
app-dir: integration/pre_standalone_project
pkg-manager: yarn
- node/install-packages:
app-dir: integration/workspace
pkg-manager: yarn
Expand Down
15 changes: 15 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,18 @@ npm_translate_lock(
load("@npm_integration_project//:repositories.bzl", npm_integration_project_repositories = "npm_repositories")

npm_integration_project_repositories()

npm_translate_lock(
name = "npm_integration_pre_standalone_project",
data = [
"//integration/pre_standalone_project:package.json",
"//integration/pre_standalone_project:pnpm-workspace.yaml",
],
npmrc = "//:.npmrc",
pnpm_lock = "//integration/pre_standalone_project:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)

load("@npm_integration_pre_standalone_project//:repositories.bzl", npm_integration_pre_standalone_project_repositories = "npm_repositories")

npm_integration_pre_standalone_project_repositories()
3 changes: 3 additions & 0 deletions integration/lsp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jasmine_test(
data = [
"//integration",
"//integration/project",
"//integration/pre_standalone_project",
"//integration/pre_standalone_project:node_modules/@angular/core",
"//integration/pre_standalone_project:node_modules/@angular/common",
"//server:index",
],
args = ["*_spec.js"],
Expand Down
29 changes: 22 additions & 7 deletions integration/lsp/ivy_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
*/

import * as fs from 'fs';
import {join} from 'path';
import {promisify} from 'util';
import {MessageConnection} from 'vscode-jsonrpc';
import * as lsp from 'vscode-languageserver-protocol';
import {URI} from 'vscode-uri';

import {ProjectLanguageService, ProjectLanguageServiceParams, SuggestStrictMode, SuggestStrictModeParams} from '../../common/notifications';
import {GetComponentsWithTemplateFile, GetTcbRequest, GetTemplateLocationForComponent, IsInAngularProject} from '../../common/requests';
import {APP_COMPONENT, APP_COMPONENT_MODULE_URI, APP_COMPONENT_URI, BAR_COMPONENT, BAR_COMPONENT_URI, FOO_COMPONENT, FOO_COMPONENT_URI, FOO_TEMPLATE, FOO_TEMPLATE_URI, IS_BAZEL, PROJECT_PATH, TSCONFIG} from '../test_constants';
import {APP_COMPONENT, APP_COMPONENT_MODULE_URI, APP_COMPONENT_URI, BAR_COMPONENT, BAR_COMPONENT_URI, FOO_COMPONENT, FOO_COMPONENT_URI, FOO_TEMPLATE, FOO_TEMPLATE_URI, IS_BAZEL, PRE_STANDALONE_PROJECT_PATH, PROJECT_PATH, TSCONFIG} from '../test_constants';

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

const setTimeoutP = promisify(setTimeout);

Expand All @@ -26,20 +27,25 @@ describe('Angular Ivy language server', () => {
let client: MessageConnection;

beforeEach(async () => {
await initServer({});
});

afterEach(() => {
client.dispose();
});

async function initServer(options: Partial<ServerOptions>) {
client = createConnection({
ivy: true,
...options,
});
// If debugging, set to
// - lsp.Trace.Messages to inspect request/response/notification, or
// - lsp.Trace.Verbose to inspect payload
client.trace(lsp.Trace.Off, createTracer());
client.listen();
await initializeServer(client);
});

afterEach(() => {
client.dispose();
});
}

it('should handle hover on inline template', async () => {
openTextDocument(client, APP_COMPONENT);
Expand Down Expand Up @@ -547,6 +553,15 @@ export class AppComponent {
expect(response).toBeNull();
});

it('should handle apps where standalone is not enabled by default (pre v19)', async () => {
await initServer({angularCoreVersion: '18.0.0'})
const moduleFile = join(PRE_STANDALONE_PROJECT_PATH, 'app/app.module.ts');

openTextDocument(client, moduleFile);
const diagnostics = await getDiagnosticsForFile(client, moduleFile);
expect(diagnostics.length).toBe(0);
});

it('should provide a "go to component" codelens', async () => {
openTextDocument(client, FOO_TEMPLATE);
const codeLensResponse = await client.sendRequest(lsp.CodeLensRequest.type, {
Expand Down
4 changes: 4 additions & 0 deletions integration/lsp/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface ServerOptions {
ivy: boolean;
includeAutomaticOptionalChainCompletions?: boolean;
includeCompletionsWithSnippetText?: boolean;
angularCoreVersion?: string;
}

export function createConnection(serverOptions: ServerOptions): MessageConnection {
Expand All @@ -37,6 +38,9 @@ export function createConnection(serverOptions: ServerOptions): MessageConnectio
if (serverOptions.includeCompletionsWithSnippetText) {
argv.push('--includeCompletionsWithSnippetText');
}
if (serverOptions.angularCoreVersion) {
argv.push('--angularCoreVersion', serverOptions.angularCoreVersion);
}
const server = fork(SERVER_PATH, argv, {
cwd: PROJECT_PATH,
// uncomment to debug server process
Expand Down
12 changes: 12 additions & 0 deletions integration/pre_standalone_project/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@npm_integration_pre_standalone_project//:defs.bzl", "npm_link_all_packages")
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

npm_link_all_packages(name = "node_modules")

copy_to_bin(
name = "pre_standalone_project",
srcs = glob(["**"]),
visibility = [
"//integration/lsp:__pkg__",
],
)
11 changes: 11 additions & 0 deletions integration/pre_standalone_project/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';

@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
})
export class AppComponent {
name = 'Angular';
@Input() appInput = '';
@Output() appOutput = new EventEmitter<string>();
}
18 changes: 18 additions & 0 deletions integration/pre_standalone_project/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';

import {AppComponent} from './app.component';
import {FooComponent} from './foo.component';

@NgModule({
imports: [
CommonModule,
],
declarations: [
AppComponent,
FooComponent,
],
bootstrap: [AppComponent]
})
export class AppModule {
}
4 changes: 4 additions & 0 deletions integration/pre_standalone_project/app/foo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{title | uppercase}}
<span class="subtitle">
subtitle
</span>
8 changes: 8 additions & 0 deletions integration/pre_standalone_project/app/foo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from '@angular/core';

@Component({
templateUrl: 'foo.component.html',
})
export class FooComponent {
title = 'Foo Component';
}
8 changes: 8 additions & 0 deletions integration/pre_standalone_project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "angular-ls-integration-test-project",
"private": true,
"dependencies": {
"@angular/common": "18.2.10",
"@angular/core": "18.2.10"
}
}
36 changes: 36 additions & 0 deletions integration/pre_standalone_project/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions integration/pre_standalone_project/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- .
15 changes: 15 additions & 0 deletions integration/pre_standalone_project/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"moduleResolution": "node",
"experimentalDecorators": true,
"target": "es2015",
"strict": true,
"typeRoots": [
"node_modules/@types"
]
},
"angularCompilerOptions": {
"strictTemplates": true,
"strictInjectionParameters": true
}
}
5 changes: 4 additions & 1 deletion integration/test_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const PACKAGE_ROOT = IS_BAZEL ? resolve(__dirname, '..') : resolve(__dirn
export const SERVER_PATH = IS_BAZEL ? join(PACKAGE_ROOT, 'server', 'index.js') :
join(PACKAGE_ROOT, 'dist', 'npm', 'server', 'index.js');
export const PROJECT_PATH = join(PACKAGE_ROOT, 'integration', 'project');
export const PRE_STANDALONE_PROJECT_PATH =
join(PACKAGE_ROOT, 'integration', 'pre_standalone_project');

export const APP_COMPONENT = join(PROJECT_PATH, 'app', 'app.component.ts');
export const APP_COMPONENT_URI = convertPathToFileUrl(APP_COMPONENT);
export const BAR_COMPONENT = join(PROJECT_PATH, 'app', 'bar.component.ts');
Expand All @@ -17,4 +20,4 @@ export const FOO_TEMPLATE = join(PROJECT_PATH, 'app', 'foo.component.html');
export const FOO_TEMPLATE_URI = convertPathToFileUrl(FOO_TEMPLATE);
export const FOO_COMPONENT = join(PROJECT_PATH, 'app', 'foo.component.ts');
export const FOO_COMPONENT_URI = convertPathToFileUrl(FOO_COMPONENT);
export const TSCONFIG = join(PROJECT_PATH, 'tsconfig.json');
export const TSCONFIG = join(PROJECT_PATH, 'tsconfig.json');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"test:legacy-syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
},
"dependencies": {
"@angular/language-service": "~19.0.0-next.11",
"@angular/language-service": "~19.0.0-rc.0",
"typescript": "5.6.2",
"vscode-html-languageservice": "^4.2.5",
"vscode-jsonrpc": "6.0.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
uuid "^8.3.2"
yargs "^17.0.0"

"@angular/language-service@~19.0.0-next.11":
version "19.0.0-next.11"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-19.0.0-next.11.tgz#2c35fb98e11b43007571e10f4f1190c96ac069e3"
integrity sha512-gDX3/TSF2tgp7IgvaQYbpO7mY0B5b+JUftK1jRAbiKkaFDOyhyNCpOSg0wWFnccqI7hiRO4SuYZfhjDYeIxfSA==
"@angular/language-service@~19.0.0-rc.0":
version "19.0.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-19.0.0-rc.0.tgz#0156e6207496b43b06af27f289d6242a899ab39c"
integrity sha512-e4aHLmP4S7PyX3K240mK9bfX2qg0ddINuGaFUY+hph6m4E/PVl34yd2fQ9ksUO3IDd/0J8TBVWD7z4KOIE0SMQ==

"@assemblyscript/loader@^0.10.1":
version "0.10.1"
Expand Down
Loading