Skip to content

use brand schema for brand.yml files #11006

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 8, 2024
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
20 changes: 19 additions & 1 deletion src/core/lib/yaml-intelligence/yaml-intelligence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
import { loadDefaultSchemaDefinitions } from "../yaml-schema/definitions.ts";
import { patchMarkdownDescriptions } from "./descriptions.ts";
import { hover } from "./hover.ts";
import { getBrandConfigSchema } from "../yaml-schema/brand.ts";

interface IDEContext {
formats: string[];
Expand Down Expand Up @@ -1098,7 +1099,24 @@ const determineSchema = async (context: YamlIntelligenceContext): Promise<{
schema: extensionConfigSchema,
schemaName: "extension-config",
};
} else {
}

const brandYamlNames = [
"_brand.yml",
"_brand.yaml",
];
if (
context.path &&
brandYamlNames.some((name) => context.path!.endsWith(name))
) {
const brandYamlSchema = await getBrandConfigSchema();
return {
schema: brandYamlSchema,
schemaName: "brand",
};
}

{
const projectConfigSchema = await getProjectConfigSchema();
return {
schema: projectConfigSchema,
Expand Down
17 changes: 17 additions & 0 deletions src/core/lib/yaml-schema/brand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* brand.ts
*
* Schema for _brand.yml
*
* Copyright (C) 2024 Posit Software, PBC
*/

import { refSchema } from "./common.ts";
import { ConcreteSchema } from "./types.ts";

// deno-lint-ignore require-await
export const getBrandConfigSchema: () => Promise<
ConcreteSchema
> = async () => {
return refSchema("brand", "");
};
29 changes: 23 additions & 6 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22944,6 +22944,7 @@ var require_yaml_intelligence_resources = __commonJS({
"Monitor the hash and change slides accordingly",
"Include the current fragment in the URL",
"Play a subtle sound when changing slides",
"Deactivate jump to slide feature.",
{
short: "Slides that are too tall to fit within a single page will expand onto\nmultiple pages",
long: "Slides that are too tall to fit within a single page will expand onto\nmultiple pages. You can limit how many pages a slide may expand to using\nthis option."
Expand Down Expand Up @@ -23781,8 +23782,7 @@ var require_yaml_intelligence_resources = __commonJS({
},
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
"Manuscript configuration",
"internal-schema-hack",
"Deactivate jump to slide feature."
"internal-schema-hack"
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -24011,12 +24011,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 190204,
_internalId: 190350,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 190196,
_internalId: 190342,
type: "enum",
enum: [
"png",
Expand All @@ -24032,7 +24032,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
_internalId: 190203,
_internalId: 190349,
type: "anyOf",
anyOf: [
{
Expand Down Expand Up @@ -33935,6 +33935,11 @@ async function locateCellWithCursor(context) {
return foundCell;
}

// ../yaml-schema/brand.ts
var getBrandConfigSchema = async () => {
return refSchema("brand", "");
};

// yaml-intelligence.ts
function getTagValue(schema2, tag) {
if (schema2 === true || schema2 === false) {
Expand Down Expand Up @@ -34663,7 +34668,19 @@ var determineSchema = async (context) => {
schema: extensionConfigSchema,
schemaName: "extension-config"
};
} else {
}
const brandYamlNames = [
"_brand.yml",
"_brand.yaml"
];
if (context.path && brandYamlNames.some((name) => context.path.endsWith(name))) {
const brandYamlSchema = await getBrandConfigSchema();
return {
schema: brandYamlSchema,
schemaName: "brand"
};
}
{
const projectConfigSchema = await getProjectConfigSchema();
return {
schema: projectConfigSchema,
Expand Down
29 changes: 23 additions & 6 deletions src/resources/editor/tools/yaml/web-worker.js

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

10 changes: 5 additions & 5 deletions src/resources/editor/tools/yaml/yaml-intelligence-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -15916,6 +15916,7 @@
"Monitor the hash and change slides accordingly",
"Include the current fragment in the URL",
"Play a subtle sound when changing slides",
"Deactivate jump to slide feature.",
{
"short": "Slides that are too tall to fit within a single page will expand onto\nmultiple pages",
"long": "Slides that are too tall to fit within a single page will expand onto\nmultiple pages. You can limit how many pages a slide may expand to using\nthis option."
Expand Down Expand Up @@ -16753,8 +16754,7 @@
},
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
"Manuscript configuration",
"internal-schema-hack",
"Deactivate jump to slide feature."
"internal-schema-hack"
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -16983,12 +16983,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 190204,
"_internalId": 190350,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 190196,
"_internalId": 190342,
"type": "enum",
"enum": [
"png",
Expand All @@ -17004,7 +17004,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 190203,
"_internalId": 190349,
"type": "anyOf",
"anyOf": [
{
Expand Down
Loading