diff --git a/CHANGELOG.md b/CHANGELOG.md index db98f7a..0e0429a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ This project adhere's to [Semantic Versioning](https://semver.org/spec/v2.0.0.ht ## [unreleased] +- Update README.md for version 3. +- Fix bug that prevented using fallback config. +- Add timestamps to output. + ## [3.0.1] - Fix bug in setting config `grepPath`. diff --git a/README.md b/README.md index bdfbed7..a455df0 100644 --- a/README.md +++ b/README.md @@ -26,36 +26,83 @@ Most of the properties are optional, so you can make use of only the features th { "languageId": "cabal", "formatCommand": "cabal-fmt --stdout", - "apiSearchUrl": "https://hoogle.haskell.org/?hoogle=${query}" + "apiSearchUrl": "https://hackage.haskell.org/packages/search?terms=${query}" }, { "languageId": "haskell", "serverCommand": "static-ls", "formatCommand": "fourmolu --mode stdout --stdin-input-file ${file}", "apiSearchUrl": "https://hoogle.haskell.org/?hoogle=${query}", - "tags": { - "file": ".tags", - "initTagsCommand": "ghc-tags -c", - "refreshTagsCommand": "ghc-tags -c", - "completionsProvider": true, - "definitionsProvider": true, - "importsProvider": { - "importLinePattern": "import ${module} (${symbol})", - "matchFromFilepath": "([A-Z][A-Za-z0-9_']*)(\\/([A-Z][A-Za-z0-9_']*))*\\.hs", - "renderModuleName": [ - { - "tag": "replace", - "from": "\\.hs", - "to": "" - }, - { - "tag": "replace", - "from": "\\/", - "to": "." - } - ] + "tags": [ + { + "file": ".tags", + "initTagsCommand": "ghc-tags -c", + "refreshTagsCommand": "ghc-tags -c", + "completionsProvider": true, + "definitionsProvider": true, + "importsProvider": { + "importLinePattern": "import ${module} (${symbol})", + "matchFromFilepath": "([A-Z][A-Za-z0-9_']*)(\\/([A-Z][A-Za-z0-9_']*))*\\.hs", + "renderModuleName": [ + { + "tag": "replace", + "from": "\\.hs", + "to": "" + }, + { + "tag": "replace", + "from": "\\/", + "to": "." + } + ] + } + }, + { + "file": "package-deps-index.tsv", + "completionsProvider": true, + "importsProvider": { + "importLinePattern": "import ${module}", + "matchFromFilepath": "(.*)", + "renderModuleName": [ + { + "tag": "replace", + "from": "(Data\\.ByteString.*)", + "to": "$1 qualified as BS" + }, + { + "tag": "replace", + "from": "(Data\\.Text.*)", + "to": "$1 qualified as T" + }, + { + "tag": "replace", + "from": "(Data\\.ByteString.*Lazy.*) qualified as BS", + "to": "$1 qualified as BSL" + }, + { + "tag": "replace", + "from": "(Data\\.Text.*Lazy.*) qualified as T", + "to": "$1 qualified as TL" + }, + { + "tag": "replace", + "from": "(Data\\.Map.*)", + "to": "$1 qualified as M" + }, + { + "tag": "replace", + "from": "(Data\\.Set.*)", + "to": "$1 qualified as S" + }, + { + "tag": "replace", + "from": "(Data\\.Vector.*)", + "to": "$1 qualified as V" + } + ] + } } - }, + ], "annotations": [ { "file": "ghc-out.json", @@ -125,6 +172,16 @@ export type TConfig = { * If `true`, Alloglot will log more output. */ verboseOutput?: boolean + + /** + * If `true`, Alloglot will merge `.vscode/alloglot.json` into its config. + */ + mergeConfigs?: boolean + + /** + * Path to GNU Grep. Parsing tags files depends on GNU Grep. (BSD Grep is not supported.) + */ + grepPath?: string } /** @@ -156,9 +213,9 @@ export type LanguageConfig = { apiSearchUrl?: string /** - * Configuration for using a tags file to suggest completions, definitions, or imports. + * A list of tags files to use to find definitions, suggest completions, or suggest imports. */ - tags?: TagsConfig + tags?: Array /** * A list of files to watch for compiler-generated JSON output. diff --git a/package.json b/package.json index 80b6f00..6faa145 100644 --- a/package.json +++ b/package.json @@ -51,27 +51,33 @@ "properties": { "alloglot.activateCommand": { "type": "string", - "description": "A shell command to run on activation. The command will run asynchronously. It will be killed (if it's still running) on deactivation." + "description": "A shell command to run on activation. The command will run asynchronously. It will be killed (if it's still running) on deactivation.", + "default": null }, "alloglot.deactivateCommand": { "type": "string", - "description": "A shell command to run on deactivation." + "description": "A shell command to run on deactivation.", + "default": null }, "alloglot.verboseOutput": { "type": "boolean", - "description": "If `true`, Alloglot will log more output." + "description": "If `true`, Alloglot will log more output.", + "default": null }, "alloglot.mergeConfigs": { "type": "boolean", - "description": "If `true`, Alloglot will merge `.vscode/alloglot.json` into its config." + "description": "If `true`, Alloglot will merge `.vscode/alloglot.json` into its config.", + "default": null }, "alloglot.grepPath": { "type": "string", - "description": "Path to GNU Grep. Parsing tags files depends on GNU Grep. (BSD Grep is not supported.)" + "description": "Path to GNU Grep. Parsing tags files depends on GNU Grep. (BSD Grep is not supported.)", + "default": null }, "alloglot.languages": { "type": "array", "description": "An array of language configurations. See README.md for schema.", + "default": null, "items": { "type": "object", "required": [ diff --git a/src/utils.ts b/src/utils.ts index ca9a2ff..7a7cbfe 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -105,9 +105,31 @@ export namespace HierarchicalOutputChannel { * Spawned channels will have the same name as the parent channel, so messages appear in the same output window. */ export function make(name: string): IHierarchicalOutputChannel { + return addTimestamps(makeNoTimestamps(name)) + } + + function makeNoTimestamps(name: string): IHierarchicalOutputChannel { return promote([], vscode.window.createOutputChannel(name)) } + function addTimestamps(output: IHierarchicalOutputChannel): IHierarchicalOutputChannel { + return { + ...output, + + append(value: string) { + output.append(`[${timestamp()}] ${value}`) + }, + + appendLine(value: string) { + output.appendLine(`[${timestamp()}] ${value}`) + } + } + } + + function timestamp(): string { + return new Date().toJSON().split('T')[1].replace(/\.\d*Z/, ' UTC') + } + function addPrefix(output: vscode.OutputChannel, prefix: string): vscode.OutputChannel { return { ...output, @@ -135,7 +157,7 @@ export namespace HierarchicalOutputChannel { split() { const name = [output.name, ...prefixPath].join('-') output.appendLine(alloglot.ui.splittingOutputChannel(name)) - return make(name) + return makeNoTimestamps(name) } } }