Skip to content
Draft
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
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const allFilesConfig = defineConfig({
/**
* Unicorn
*/
"unicorn/filename-case": ["error", { case: "kebabCase" }],
"unicorn/filename-case": ["error", { case: "kebabCase", checkDirectories: false }],

/**
* Core
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/server/client-config-provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Connection } from "vscode-languageserver/node.js";
import type { Connection } from "vscode-languageserver/node";
import { ServerHost } from "./types.js";

interface LSPConfig {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/server/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
Range,
Diagnostic as VSDiagnostic,
} from "vscode-languageserver";
import { DiagnosticSeverity } from "vscode-languageserver";
import type { TextDocument } from "vscode-languageserver-textdocument";
import { DiagnosticSeverity } from "vscode-languageserver/node.js";
import {
getDiagnosticTemplateInstantitationTrace,
getSourceLocation,
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TextDocuments,
WorkspaceEdit,
createConnection,
} from "vscode-languageserver/node.js";
} from "vscode-languageserver/node";
import { NodeHost } from "../core/node-host.js";
import { typespecVersion } from "../manifest.js";
import { createClientConfigProvider } from "./client-config-provider.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler/src/server/serverlib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TextDocument } from "vscode-languageserver-textdocument";
import {
CodeAction,
CodeActionKind,
Expand Down Expand Up @@ -48,7 +47,8 @@ import {
Diagnostic as VSDiagnostic,
WorkspaceEdit,
WorkspaceFoldersChangeEvent,
} from "vscode-languageserver/node.js";
} from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
import { getSymNode } from "../core/binder.js";
import { CharCode } from "../core/charcode.js";
import { resolveCodeFix } from "../core/code-fixes.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler/src/server/tspconfig/completion.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TextDocument } from "vscode-languageserver-textdocument";
import {
CompletionItem,
CompletionItemKind,
Position,
Range,
TextEdit,
} from "vscode-languageserver/node.js";
} from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
import { Document, isMap, isPair, Node } from "yaml";
import { emitterOptionsSchema, TypeSpecConfigJsonSchema } from "../../config/config-schema.js";
import { compilerFeatureNames, compilerFeatures } from "../../core/features.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/src/testing/test-server-host.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pathToFileURL } from "url";
import { Diagnostic, FileChangeType, TextDocumentIdentifier } from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
import { Diagnostic, FileChangeType, TextDocumentIdentifier } from "vscode-languageserver/node.js";
import { CompilerOptions } from "../core/options.js";
import { parse, visitChildren } from "../core/parser.js";
import { resolvePath } from "../core/path-utils.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/completion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CompletionItemKind,
CompletionList,
MarkupKind,
} from "vscode-languageserver/node.js";
} from "vscode-languageserver";
import { extractCursor, extractSquiggles } from "../../src/testing/source-utils.js";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "path";
import { describe, expect, it } from "vitest";
import { CompletionList } from "vscode-languageserver/node.js";
import { CompletionList } from "vscode-languageserver";
import { joinPaths } from "../../src/index.js";
import { extractCursor } from "../../src/testing/source-utils.js";
import { createTestServerHost } from "../../src/testing/test-server-host.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/document-highlight.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual } from "assert";
import { describe, it } from "vitest";
import { DocumentHighlight } from "vscode-languageserver/node.js";
import { DocumentHighlight } from "vscode-languageserver";
import { extractCursor } from "../../src/testing/source-utils.js";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/documentsymbol.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual } from "assert";
import { describe, it } from "vitest";
import { DocumentSymbol, SymbolKind } from "vscode-languageserver/node.js";
import { DocumentSymbol, SymbolKind } from "vscode-languageserver";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

type SimplifiedSymbol = {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/folding.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual } from "assert";
import { describe, it } from "vitest";
import { FoldingRange } from "vscode-languageserver/node.js";
import { FoldingRange } from "vscode-languageserver";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

describe("compiler: server: foldingRange", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/get-hover.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, ok } from "assert";
import { describe, it } from "vitest";
import { Hover, MarkupKind } from "vscode-languageserver/node.js";
import { Hover, MarkupKind } from "vscode-languageserver";
import { extractCursor } from "../../src/testing/source-utils.js";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/rename.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, strictEqual } from "assert";
import { describe, it } from "vitest";
import { Range } from "vscode-languageserver/node.js";
import { Range } from "vscode-languageserver";
import { extractCursor } from "../../src/testing/source-utils.js";
import { createTestServerHost, getTestIdentifiers } from "../../src/testing/test-server-host.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/test/server/signature-help.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual } from "assert";
import { describe, it } from "vitest";
import { MarkupKind, SignatureHelp } from "vscode-languageserver/node.js";
import { MarkupKind, SignatureHelp } from "vscode-languageserver";
import { extractCursor } from "../../src/testing/source-utils.js";
import { createTestServerHost } from "../../src/testing/test-server-host.js";

Expand Down
1 change: 1 addition & 0 deletions packages/emitter-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@alloy-js/rollup-plugin": "catalog:",
"@alloy-js/typescript": "catalog:",
"@typespec/compiler": "workspace:^",
"@types/node": "catalog:",
"concurrently": "catalog:",
"pathe": "catalog:",
"prettier": "catalog:",
Expand Down
2 changes: 1 addition & 1 deletion packages/emitter-framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"outDir": "dist",
"rootDir": "./",
"verbatimModuleSyntax": true,
"types": ["@alloy-js/core/testing/matchers"]
"types": ["node", "@alloy-js/core/testing/matchers"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
"exclude": ["node_modules", "dist"]
Expand Down
3 changes: 2 additions & 1 deletion packages/html-program-viewer/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));

const packageJson = JSON.parse(readFileSync(resolve(__dirname, "package.json")).toString());
const dependencies = Object.keys(packageJson.dependencies);
const externals = ["url", ...dependencies];
const peerDependencies = Object.keys(packageJson.peerDependencies ?? {});
const externals = ["url", ...dependencies, ...peerDependencies];

export default defineConfig({
build: {
Expand Down
3 changes: 2 additions & 1 deletion packages/http-canonicalization/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"declarationMap": true,
"outDir": "dist",
"rootDir": "./",
"verbatimModuleSyntax": true
"verbatimModuleSyntax": true,
"types": ["node"]
},
"exclude": ["node_modules", "dist"]
}
3 changes: 2 additions & 1 deletion packages/http-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"declarationMap": true,
"jsx": "preserve",
"jsxImportSource": "@alloy-js/core",
"outDir": "dist"
"outDir": "dist",
"types": ["node"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
"exclude": ["node_modules", "dist"]
Expand Down
4 changes: 2 additions & 2 deletions packages/http-server-js/generated-defs/package.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export const hsjsDependencies: Record<string, string> = {
"@types/express": "^5.0.6",
"@types/morgan": "^1.9.10",
"@types/node": "^25.5.2",
"@types/node": "^26.0.0",
"@types/swagger-ui-express": "^4.1.8",
"@typespec/compiler": "workspace:^",
"@typespec/http": "workspace:^",
Expand All @@ -26,7 +26,7 @@ export const hsjsDependencies: Record<string, string> = {
"pathe": "^2.0.3",
"picocolors": "^1.1.1",
"swagger-ui-express": "^5.0.1",
"temporal-polyfill": "^0.3.2",
"temporal-polyfill": "^1.0.1",
"tsx": "^4.21.0",
"typescript": "~6.0.2",
"vitest": "^4.1.3",
Expand Down
28 changes: 25 additions & 3 deletions packages/playground/src/lsp/lsp-to-monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ import * as monaco from "monaco-editor";
import type * as lsp from "vscode-languageserver";
import { DiagnosticSeverity } from "vscode-languageserver";

function markupContentToString(value: string | lsp.MarkupContent): string {
return typeof value === "string" ? value : value.value;
}

function markupContentToMonaco(
value: string | lsp.MarkupContent | undefined,
): string | monaco.IMarkdownString | undefined {
if (value === undefined) {
return undefined;
}
if (typeof value === "string") {
return value;
}
return value.kind === "markdown" ? { value: value.value } : value.value;
}

function range(range: lsp.Range): monaco.IRange {
return {
startColumn: range.start.character + 1,
Expand Down Expand Up @@ -34,8 +50,13 @@ function signatureHelp(help: lsp.SignatureHelp | undefined): monaco.languages.Si
return {
signatures:
help?.signatures.map((x) => ({
...x,
parameters: x.parameters ?? [],
label: x.label,
documentation: markupContentToMonaco(x.documentation),
parameters: (x.parameters ?? []).map((p) => ({
label: p.label,
documentation: markupContentToMonaco(p.documentation),
})),
activeParameter: x.activeParameter ?? undefined,
})) ?? [],
activeSignature: help?.activeSignature ?? 0,
activeParameter: help?.activeParameter ?? 0,
Expand Down Expand Up @@ -66,7 +87,7 @@ function severity(severity: lsp.DiagnosticSeverity): monaco.MarkerSeverity {
function diagnostic(diagnostic: lsp.Diagnostic): monaco.editor.IMarkerData {
return {
severity: diagnostic.severity ? severity(diagnostic.severity) : monaco.MarkerSeverity.Error,
message: diagnostic.message,
message: markupContentToString(diagnostic.message),
code: diagnostic.code?.toString(),
source: diagnostic.source,
startLineNumber: diagnostic.range.start.line + 1,
Expand All @@ -93,4 +114,5 @@ export const LspToMonaco = {
signatureHelp,
codeAction,
command,
markupContentToString,
} as const;
2 changes: 1 addition & 1 deletion packages/playground/src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function registerMonacoLanguage(host: BrowserHost) {
.filter((d) => d.tags !== undefined && d.tags.length > 0)
.map((d) => ({
severity: monaco.MarkerSeverity.Hint,
message: d.message,
message: LspToMonaco.markupContentToString(d.message),
startLineNumber: d.range.start.line + 1,
startColumn: d.range.start.character + 1,
endLineNumber: d.range.end.line + 1,
Expand Down
80 changes: 62 additions & 18 deletions packages/typespec-vscode/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ granted herein, whether by implication, estoppel or otherwise.
1. @babel/code-frame version 7.29.7 (https://github.com/babel/babel)
2. @babel/helper-validator-identifier version 7.29.7 (https://github.com/babel/babel)
3. ajv version 8.20.0 (ajv-validator/ajv)
4. balanced-match version 1.0.2 (https://github.com/juliangruber/balanced-match)
5. brace-expansion version 2.1.1 (https://github.com/juliangruber/brace-expansion)
4. balanced-match version 4.0.4 (https://github.com/juliangruber/balanced-match)
5. brace-expansion version 5.0.6 (ssh://git@github.com/juliangruber/brace-expansion)
6. change-case version 5.4.4 (https://github.com/blakeembrey/change-case)
7. cross-spawn version 7.0.6 (git@github.com:moxystudio/node-cross-spawn)
8. fast-deep-equal version 3.1.3 (https://github.com/epoberezkin/fast-deep-equal)
Expand All @@ -22,11 +22,11 @@ granted herein, whether by implication, estoppel or otherwise.
12. isexe version 4.0.0 (https://github.com/isaacs/isexe)
13. js-tokens version 4.0.0 (lydell/js-tokens)
14. json-schema-traverse version 1.0.0 (https://github.com/epoberezkin/json-schema-traverse)
15. minimatch version 5.1.9 (https://github.com/isaacs/minimatch)
15. minimatch version 10.2.5 (git@github.com:isaacs/minimatch)
16. mustache version 4.2.0 (https://github.com/janl/mustache.js)
17. path-key version 3.1.1 (sindresorhus/path-key)
18. picocolors version 1.1.1 (alexeyraspopov/picocolors)
19. semver version 7.8.1 (https://github.com/npm/node-semver)
19. semver version 7.8.5 (https://github.com/npm/node-semver)
20. shebang-command version 2.0.0 (kevva/shebang-command)
21. shebang-regex version 3.0.0 (sindresorhus/shebang-regex)
22. which version 2.0.2 (https://github.com/isaacs/node-which)
Expand Down Expand Up @@ -125,7 +125,9 @@ END OF ajv NOTICES AND INFORMATION
=====================================================
(MIT)

Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
Original code Copyright Julian Gruber <julian@juliangruber.com>

Port to TypeScript Copyright Isaac Z. Schlueter <i@izs.me>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -153,7 +155,9 @@ END OF balanced-match NOTICES AND INFORMATION
=====================================================
MIT License

Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
Copyright Julian Gruber <julian@juliangruber.com>

TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -455,21 +459,61 @@ END OF json-schema-traverse NOTICES AND INFORMATION

%% minimatch NOTICES AND INFORMATION BEGIN HERE
=====================================================
The ISC License
# Blue Oak Model License

Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
Version 1.0.0

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
## Purpose

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.

## Acceptance

In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.

## Copyright

Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.

## Notices

You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.

## Excuse

If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.

## Patent

Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.

## Reliability

No contributor can revoke this license.

## No Liability

**_As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim._**

=====================================================");
END OF minimatch NOTICES AND INFORMATION
Expand Down
Loading
Loading