-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
# Conflicts: # packages/compiler/src/server/serverlib.ts # packages/http-client-java/emitter/src/code-model-builder.ts # packages/http-client-java/emitter/src/emitter.ts # packages/http-client-java/generator/http-client-generator-test/package.json # packages/http-client-java/package-lock.json # packages/http-client-java/package.json # packages/typespec-vscode/src/code-action-provider.ts # packages/typespec-vscode/src/extension.ts # pnpm-lock.yaml
- Loading branch information
Showing
31 changed files
with
2,256 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- typespec-vs | ||
--- | ||
|
||
Upgrade nuget packages to avoid transitive vulnerabilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- typespec-vscode | ||
--- | ||
|
||
Support "Create TypeSpec Project" in vscode command and EXPLORER when no folder opened | ||
Add Setting "typespec.initTemplatesUrls" where user can configure additional template to use to create TypeSpec project | ||
example: | ||
``` | ||
{ | ||
"typespec.initTemplatesUrls": [ | ||
{ | ||
"name": "displayName", | ||
"url": "https://urlToTheFileContainsTemplates" | ||
}], | ||
} | ||
``` | ||
Support "Install TypeSpec Compiler/CLI globally" in vscode command to install TypeSpec compiler globally easily | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@typespec/compiler" | ||
--- | ||
|
||
Add capacities in TypeSpec Language Server to support "Scaffolding new TypeSpec project" in IDE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const NodeHost = undefined; | ||
export const CompilerPackageRoot = undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import { readFile } from "fs/promises"; | ||
import { CompilerPackageRoot } from "../core/node-host.js"; | ||
import { resolvePath } from "../core/path-utils.js"; | ||
import { CompilerHost } from "../index.js"; | ||
|
||
export const templatesDir = resolvePath(CompilerPackageRoot, "templates"); | ||
export interface LoadedCoreTemplates { | ||
readonly baseUri: string; | ||
readonly templates: Record<string, any>; | ||
} | ||
|
||
const content = JSON.parse(await readFile(resolvePath(templatesDir, "scaffolding.json"), "utf-8")); | ||
|
||
export const TypeSpecCoreTemplates = { | ||
baseUri: templatesDir, | ||
templates: content, | ||
}; | ||
let typeSpecCoreTemplates: LoadedCoreTemplates | undefined; | ||
export async function getTypeSpecCoreTemplates(host: CompilerHost): Promise<LoadedCoreTemplates> { | ||
if (typeSpecCoreTemplates === undefined) { | ||
const file = await host.readFile(resolvePath(templatesDir, "scaffolding.json")); | ||
const content = JSON.parse(file.text); | ||
typeSpecCoreTemplates = { | ||
baseUri: templatesDir, | ||
templates: content, | ||
}; | ||
} | ||
return typeSpecCoreTemplates; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createJSONSchemaValidator } from "../core/schema-validator.js"; | ||
import { Diagnostic, NoTarget, SourceFile } from "../index.js"; | ||
import { InitTemplateSchema } from "./init-template.js"; | ||
|
||
export type ValidationResult = { | ||
valid: boolean; | ||
diagnostics: readonly Diagnostic[]; | ||
}; | ||
|
||
export function validateTemplateDefinitions( | ||
template: unknown, | ||
templateName: SourceFile | typeof NoTarget, | ||
strictValidation: boolean, | ||
): ValidationResult { | ||
const validator = createJSONSchemaValidator(InitTemplateSchema, { | ||
strict: strictValidation, | ||
}); | ||
const diagnostics = validator.validate(template, templateName); | ||
return { valid: diagnostics.length === 0, diagnostics }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.