diff --git a/bsconfig.schema.json b/bsconfig.schema.json index 7c421a0d5..d83e4e285 100644 --- a/bsconfig.schema.json +++ b/bsconfig.schema.json @@ -8,6 +8,53 @@ "password" ] }, + "definitions": { + "diagnosticReporterValue": { + "oneOf": [ + { + "type": "string", + "description": "Either a preset name ('detailed' or 'github-actions') or a custom template string containing at least one known placeholder." + }, + { + "type": "object", + "required": ["type"], + "properties": { + "type": { + "type": "string", + "enum": ["detailed"] + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["type"], + "properties": { + "type": { + "type": "string", + "enum": ["github-actions"] + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["type", "format"], + "properties": { + "type": { + "type": "string", + "enum": ["custom"] + }, + "format": { + "type": "string", + "description": "Template string. Supported placeholders: {file}, {line}, {col}, {endLine}, {endCol}, {severity}, {severityCode}, {code}, {message}, {source}." + } + }, + "additionalProperties": false + } + ] + } + }, "properties": { "extends": { "description": "Relative or absolute path to another bsconfig.json file that this file should use as a base and then override. Prefix with a question mark (?) to prevent throwing an exception if the file does not exist.", @@ -300,6 +347,21 @@ "error" ] }, + "diagnosticReporters": { + "description": "Specify how diagnostics are reported to the console. Accepts a single value or an array; each diagnostic is rendered once per entry. Each value is either a preset name ('detailed', 'github-actions'), a custom template string containing at least one known placeholder ({file}, {line}, {col}, {endLine}, {endCol}, {severity}, {severityCode}, {code}, {message}, {source}), or an object with explicit `type`. Defaults to 'detailed'.", + "default": "detailed", + "oneOf": [ + { + "$ref": "#/definitions/diagnosticReporterValue" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/diagnosticReporterValue" + } + } + ] + }, "allowBrighterScriptInBrightScript": { "description": "Allow brighterscript features (classes, interfaces, etc...) to be included in BrightScript (`.brs`) files, and force those files to be transpiled.", "type": "boolean", diff --git a/docs/bsconfig.md b/docs/bsconfig.md index 13a2c12d9..9bd5a43fa 100644 --- a/docs/bsconfig.md +++ b/docs/bsconfig.md @@ -2,36 +2,47 @@ While a minimal `bsconfig.json` file is sufficient for getting started, `bsc` supports a range of helpful options. -- [allowBrighterScriptInBrightScript](#allowBrighterScriptInBrightScript) -- [autoImportComponentScript](#autoImportComponentScript) -- [bslibDestinationDir](#bslibDestinationDir) -- [createPackage](#createPackage) -- [cwd](#cwd) -- [deploy](#deploy) -- [diagnosticFilters](#diagnosticFilters) -- [diagnosticLevel](#diagnosticLevel) -- [diagnosticSeverityOverrides](#diagnosticSeverityOverrides) -- [emitDefinitions](#emitDefinitions) -- [emitFullPaths](#emitFullPaths) -- [extends](#extends) -- [files](#files) -- [host](#host) -- [minFirmwareVersion](#minFirmwareVersion) -- [outFile](#outFile) -- [password](#password) -- [plugins](#plugins) -- [project](#project) -- [pruneEmptyCodeFiles](#pruneEmptyCodeFiles) -- [removeParameterTypes](#removeParameterTypes) -- [require](#require) -- [retainStagingDir](#retainStagingDir) -- [rootDir](#rootDir) -- [sourceMap](#sourceMap) -- [relativeSourceMaps](#relativeSourceMaps) -- [sourceRoot](#sourceRoot) -- [stagingDir](#stagingDir) -- [username](#username) -- [watch](#watch) +- [bsconfig.json options](#bsconfigjson-options) + - [`allowBrighterScriptInBrightScript`](#allowbrighterscriptinbrightscript) + - [`autoImportComponentScript`](#autoimportcomponentscript) + - [`bslibDestinationDir`](#bslibdestinationdir) + - [`createPackage`](#createpackage) + - [`cwd`](#cwd) + - [`deploy`](#deploy) + - [`diagnosticFilters`](#diagnosticfilters) + - [Negative patterns in `diagnosticFilters`](#negative-patterns-in-diagnosticfilters) + - [`diagnosticLevel`](#diagnosticlevel) + - [`diagnosticReporters`](#diagnosticreporters) + - [`diagnosticSeverityOverrides`](#diagnosticseverityoverrides) + - [`emitDefinitions`](#emitdefinitions) + - [`emitFullPaths`](#emitfullpaths) + - [`extends`](#extends) + - [Optional `extends` and `project`](#optional-extends-and-project) + - [`files`](#files) + - [Excluding files](#excluding-files) + - [File pattern resolution](#file-pattern-resolution) + - [Specifying file destinations](#specifying-file-destinations) + - [File collision handling](#file-collision-handling) + - [`host`](#host) + - [`minFirmwareVersion`](#minfirmwareversion) + - [Line continuation in `.brs` files](#line-continuation-in-brs-files) + - [`outFile`](#outfile) + - [`password`](#password) + - [`plugins`](#plugins) + - [`project`](#project) + - [`pruneEmptyCodeFiles`](#pruneemptycodefiles) + - [`removeParameterTypes`](#removeparametertypes) + - [`require`](#require) + - [`retainStagingDir`](#retainstagingdir) + - [`rootDir`](#rootdir) + - [`sourceMap`](#sourcemap) + - [`relativeSourceMaps`](#relativesourcemaps) + - [`relativeSourceMaps: false` (default)](#relativesourcemaps-false-default) + - [`relativeSourceMaps: true`](#relativesourcemaps-true) + - [`sourceRoot`](#sourceroot) + - [`stagingDir`](#stagingdir) + - [`username`](#username) + - [`watch`](#watch) ## `allowBrighterScriptInBrightScript` @@ -121,6 +132,58 @@ Type: `"hint" | "info" | "warn" | "error"` Specify what diagnostic levels are printed to the console. This has no effect on what diagnostics are reported in the LanguageServer. Defaults to `"warn"`. +## `diagnosticReporters` + +Type: `string | { type: string; format?: string } | Array` + +Specify how diagnostics are reported to the console. Accepts a single value or an array; when given an array, each diagnostic is rendered once per entry (so you can, for example, emit detailed terminal output and GitHub Actions PR annotations from a single run). Defaults to `"detailed"`. + +Each value can be: + +- A **preset name**: `"detailed"` (the default rich, multi-line, colored output) or `"github-actions"` (one-line workflow commands like `::error file=...,line=...::message` so the GitHub Actions runner surfaces them as PR annotations). +- A **custom template string** containing at least one of the known placeholders. The placeholders supported are: + + | Placeholder | Value | + |------------------|---| + | `{file}` | file path (respects `emitFullPaths`) | + | `{line}` / `{col}` | 1-based start line / column | + | `{endLine}` / `{endCol}` | 1-based end line / column | + | `{severity}` | `error` / `warning` / `info` / `hint` | + | `{severityCode}` | numeric LSP severity (1=error, 2=warning, 3=info, 4=hint) | + | `{code}` | diagnostic code (e.g. `1001`) | + | `{message}` | diagnostic message | + | `{source}` | diagnostic source (e.g. `brs`) | + + Unknown placeholders pass through unchanged so typos surface visually. +- An **explicit object** with `type`: `{ "type": "detailed" }`, `{ "type": "github-actions" }`, or `{ "type": "custom", "format": "