cspell-lib 8.13.3 → 8.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/Document/isBinaryDoc.js +1 -1
- package/dist/lib/Models/TextDocument.js +1 -1
- package/dist/lib/fileTypes.d.ts +3 -0
- package/dist/lib/fileTypes.js +2 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/suggestions.d.ts +1 -1
- package/dist/lib/textValidation/determineTextDocumentSettings.js +1 -1
- package/dist/lib/trace.d.ts +1 -1
- package/package.json +17 -16
- package/dist/lib/LanguageIds.d.ts +0 -37
- package/dist/lib/LanguageIds.js +0 -310
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLanguagesForBasename, isGenerated } from '../
|
|
1
|
+
import { getLanguagesForBasename, isGenerated } from '../fileTypes.js';
|
|
2
2
|
import { basename, toUri } from '../util/Uri.js';
|
|
3
3
|
import { normalizeLanguageIds } from './normalizeLanguageIds.js';
|
|
4
4
|
export function isBinaryDoc(document) {
|
|
@@ -2,7 +2,7 @@ import assert from 'node:assert';
|
|
|
2
2
|
import { toFileURL, toURL } from '@cspell/url';
|
|
3
3
|
import { TextDocument as VsTextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
import { getFileSystem } from '../fileSystem.js';
|
|
5
|
-
import { getLanguagesForBasename } from '../
|
|
5
|
+
import { getLanguagesForBasename } from '../fileTypes.js';
|
|
6
6
|
import * as Uri from '../util/Uri.js';
|
|
7
7
|
class TextDocumentImpl {
|
|
8
8
|
languageId;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { FileTypeId, FileTypeId as LanguageId } from '@cspell/filetypes';
|
|
2
|
+
export { findMatchingFileTypes as getLanguagesForBasename, getFileTypesForExt as getLanguagesForExt, isFileTypeGenerated as isGenerated, } from '@cspell/filetypes';
|
|
3
|
+
//# sourceMappingURL=fileTypes.d.ts.map
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export * as ExclusionHelper from './exclusionHelper.js';
|
|
|
6
6
|
export { FeatureFlag, FeatureFlags, getSystemFeatureFlags, UnknownFeatureFlagError } from './FeatureFlags/index.js';
|
|
7
7
|
export type { VFileSystemProvider, VirtualFS } from './fileSystem.js';
|
|
8
8
|
export { FSCapabilityFlags, getVirtualFS } from './fileSystem.js';
|
|
9
|
+
export { getLanguagesForBasename as getLanguageIdsForBaseFilename, getLanguagesForExt } from './fileTypes.js';
|
|
9
10
|
export { getDictionary } from './getDictionary.js';
|
|
10
|
-
export { getLanguagesForBasename as getLanguageIdsForBaseFilename, getLanguagesForExt } from './LanguageIds.js';
|
|
11
11
|
export type { CreateTextDocumentParams, TextDocument, TextDocumentLine, TextDocumentRef, } from './Models/TextDocument.js';
|
|
12
12
|
export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
|
|
13
13
|
export type { PerfTimer } from './perf/index.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -3,8 +3,8 @@ export { fileToDocument, fileToTextDocument, isBinaryFile } from './Document/ind
|
|
|
3
3
|
export * as ExclusionHelper from './exclusionHelper.js';
|
|
4
4
|
export { FeatureFlags, getSystemFeatureFlags, UnknownFeatureFlagError } from './FeatureFlags/index.js';
|
|
5
5
|
export { FSCapabilityFlags, getVirtualFS } from './fileSystem.js';
|
|
6
|
+
export { getLanguagesForBasename as getLanguageIdsForBaseFilename, getLanguagesForExt } from './fileTypes.js';
|
|
6
7
|
export { getDictionary } from './getDictionary.js';
|
|
7
|
-
export { getLanguagesForBasename as getLanguageIdsForBaseFilename, getLanguagesForExt } from './LanguageIds.js';
|
|
8
8
|
export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
|
|
9
9
|
export { createPerfTimer } from './perf/index.js';
|
|
10
10
|
export { calcOverrideSettings, checkFilenameMatchesGlob, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSpellSettings, LocaleId } from '@cspell/cspell-types';
|
|
2
|
-
import type { LanguageId } from './
|
|
2
|
+
import type { LanguageId } from './fileTypes.js';
|
|
3
3
|
import type { SpellingDictionaryCollection, SuggestionResult, SuggestOptions } from './SpellingDictionary/index.js';
|
|
4
4
|
export interface WordSuggestion extends SuggestionResult {
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
|
-
import { getLanguagesForBasename } from '../
|
|
2
|
+
import { getLanguagesForBasename } from '../fileTypes.js';
|
|
3
3
|
import { calcOverrideSettings, getDefaultSettings, getGlobalSettings, mergeSettings } from '../Settings/index.js';
|
|
4
4
|
import { combineTextAndLanguageSettings } from '../Settings/TextDocumentSettings.js';
|
|
5
5
|
import { uriToFilePath } from '../util/Uri.js';
|
package/dist/lib/trace.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSpellSettings, LocaleId } from '@cspell/cspell-types';
|
|
2
|
-
import type { LanguageId } from './
|
|
2
|
+
import type { LanguageId } from './fileTypes.js';
|
|
3
3
|
import type { DictionaryTraceResult, WordSplits } from './textValidation/traceWord.js';
|
|
4
4
|
export interface TraceResult extends DictionaryTraceResult {
|
|
5
5
|
/** True if the dictionary is currently active. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.2",
|
|
4
4
|
"description": "A library of useful functions used across various cspell tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -58,21 +58,22 @@
|
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cspell/cspell-bundled-dicts": "8.
|
|
62
|
-
"@cspell/cspell-pipe": "8.
|
|
63
|
-
"@cspell/cspell-resolver": "8.
|
|
64
|
-
"@cspell/cspell-types": "8.
|
|
65
|
-
"@cspell/dynamic-import": "8.
|
|
66
|
-
"@cspell/
|
|
67
|
-
"@cspell/
|
|
61
|
+
"@cspell/cspell-bundled-dicts": "8.14.2",
|
|
62
|
+
"@cspell/cspell-pipe": "8.14.2",
|
|
63
|
+
"@cspell/cspell-resolver": "8.14.2",
|
|
64
|
+
"@cspell/cspell-types": "8.14.2",
|
|
65
|
+
"@cspell/dynamic-import": "8.14.2",
|
|
66
|
+
"@cspell/filetypes": "8.14.2",
|
|
67
|
+
"@cspell/strong-weak-map": "8.14.2",
|
|
68
|
+
"@cspell/url": "8.14.2",
|
|
68
69
|
"clear-module": "^4.1.2",
|
|
69
70
|
"comment-json": "^4.2.5",
|
|
70
|
-
"cspell-config-lib": "8.
|
|
71
|
-
"cspell-dictionary": "8.
|
|
72
|
-
"cspell-glob": "8.
|
|
73
|
-
"cspell-grammar": "8.
|
|
74
|
-
"cspell-io": "8.
|
|
75
|
-
"cspell-trie-lib": "8.
|
|
71
|
+
"cspell-config-lib": "8.14.2",
|
|
72
|
+
"cspell-dictionary": "8.14.2",
|
|
73
|
+
"cspell-glob": "8.14.2",
|
|
74
|
+
"cspell-grammar": "8.14.2",
|
|
75
|
+
"cspell-io": "8.14.2",
|
|
76
|
+
"cspell-trie-lib": "8.14.2",
|
|
76
77
|
"env-paths": "^3.0.0",
|
|
77
78
|
"fast-equals": "^5.0.1",
|
|
78
79
|
"gensequence": "^7.0.0",
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"devDependencies": {
|
|
89
90
|
"@cspell/dict-cpp": "^5.1.12",
|
|
90
91
|
"@cspell/dict-csharp": "^4.0.2",
|
|
91
|
-
"@cspell/dict-css": "^4.0.
|
|
92
|
+
"@cspell/dict-css": "^4.0.13",
|
|
92
93
|
"@cspell/dict-fa-ir": "^4.0.0",
|
|
93
94
|
"@cspell/dict-fr-fr": "^2.2.2",
|
|
94
95
|
"@cspell/dict-html": "^4.0.5",
|
|
@@ -101,5 +102,5 @@
|
|
|
101
102
|
"lorem-ipsum": "^2.0.8",
|
|
102
103
|
"perf-insight": "^1.2.0"
|
|
103
104
|
},
|
|
104
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "9f7c1831d4765d35f289b2a623133fc21bee4dcd"
|
|
105
106
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The data for this file was constructed from:
|
|
3
|
-
* ```
|
|
4
|
-
* cd ~/projects/clones/vscode/extensions
|
|
5
|
-
* find . -type f -iname package.json -exec pcregrep -M '(?:"id":.*)|(?:"extensions":[^\]]+)' {} \; > ~/projects/cspell/src/languageIds.txt`
|
|
6
|
-
* ```
|
|
7
|
-
*/
|
|
8
|
-
export interface LanguageExtensionDefinition {
|
|
9
|
-
id: string;
|
|
10
|
-
/** List of extensions starting with '.' */
|
|
11
|
-
extensions: string[];
|
|
12
|
-
/** Filenames that do not have an extension or have a different type than their implied extension */
|
|
13
|
-
filenames?: string[];
|
|
14
|
-
/** Indicates that it is a Text or Binary file type. */
|
|
15
|
-
format?: 'Text' | 'Binary';
|
|
16
|
-
/** Optional Description */
|
|
17
|
-
description?: string;
|
|
18
|
-
}
|
|
19
|
-
export type LanguageDefinition = LanguageExtensionDefinition;
|
|
20
|
-
export type LanguageDefinitions = LanguageDefinition[];
|
|
21
|
-
export type ExtensionToLanguageIdMapSet = Map<string, Set<string>>;
|
|
22
|
-
export type ExtensionToLanguageIdMap = Map<string, string[]>;
|
|
23
|
-
export declare const languageExtensionDefinitions: LanguageDefinitions;
|
|
24
|
-
export type LanguageId = string;
|
|
25
|
-
export declare const binaryLanguages: Set<string>;
|
|
26
|
-
export declare const generatedFiles: Set<string>;
|
|
27
|
-
export declare const languageIds: LanguageId[];
|
|
28
|
-
export declare function isBinaryExt(ext: string): boolean;
|
|
29
|
-
export declare function isBinaryFile(basename: string): boolean;
|
|
30
|
-
export declare function isBinary(languageId: LanguageId | LanguageId[] | Iterable<LanguageId>): boolean;
|
|
31
|
-
export declare function isGeneratedExt(ext: string): boolean;
|
|
32
|
-
export declare function isGeneratedFile(basename: string): boolean;
|
|
33
|
-
export declare function isGenerated(languageId: LanguageId | LanguageId[] | Iterable<LanguageId>): boolean;
|
|
34
|
-
export declare function buildLanguageExtensionMapSet(defs: LanguageDefinitions): ExtensionToLanguageIdMapSet;
|
|
35
|
-
export declare function getLanguagesForExt(ext: string): string[];
|
|
36
|
-
export declare function getLanguagesForBasename(basename: string): string[];
|
|
37
|
-
//# sourceMappingURL=LanguageIds.d.ts.map
|
package/dist/lib/LanguageIds.js
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The data for this file was constructed from:
|
|
3
|
-
* ```
|
|
4
|
-
* cd ~/projects/clones/vscode/extensions
|
|
5
|
-
* find . -type f -iname package.json -exec pcregrep -M '(?:"id":.*)|(?:"extensions":[^\]]+)' {} \; > ~/projects/cspell/src/languageIds.txt`
|
|
6
|
-
* ```
|
|
7
|
-
*/
|
|
8
|
-
import { autoResolve } from './util/AutoResolve.js';
|
|
9
|
-
export const languageExtensionDefinitions = [
|
|
10
|
-
{ id: 'ada', extensions: ['.adb', '.ads'] },
|
|
11
|
-
{ id: 'apiblueprint', extensions: ['.apib', '.apiblueprint'] },
|
|
12
|
-
{ id: 'asciidoc', extensions: ['.adoc', '.asc', '.asciidoc'] },
|
|
13
|
-
{ id: 'bat', extensions: ['.bat', '.cmd'] },
|
|
14
|
-
{ id: 'clojure', extensions: ['.clj', '.cljs', '.cljx', '.clojure', '.edn'] },
|
|
15
|
-
{ id: 'coffeescript', extensions: ['.coffee', '.cson'] },
|
|
16
|
-
{ id: 'c', extensions: ['.c'] },
|
|
17
|
-
// cspell:ignore cmake
|
|
18
|
-
{ id: 'cmake', extensions: ['.cmake'], filenames: ['CMakeLists.txt'] },
|
|
19
|
-
{
|
|
20
|
-
id: 'cpp',
|
|
21
|
-
extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx', '.h', '.mm', '.ino', '.inl'],
|
|
22
|
-
},
|
|
23
|
-
{ id: 'csharp', extensions: ['.cs'] },
|
|
24
|
-
{ id: 'css', extensions: ['.css'] },
|
|
25
|
-
{ id: 'dhall', extensions: ['.dhall'] },
|
|
26
|
-
{ id: 'diff', extensions: ['.diff', '.patch', '.rej'] },
|
|
27
|
-
{ id: 'dockerfile', extensions: ['.dockerfile'], filenames: ['Dockerfile', 'dockerfile', 'Dockerfile.dev'] },
|
|
28
|
-
{ id: 'elisp', extensions: ['.el'] },
|
|
29
|
-
{ id: 'elixir', extensions: ['.ex', '.exs'] },
|
|
30
|
-
{ id: 'fsharp', extensions: ['.fs', '.fsi', '.fsx', '.fsscript'] },
|
|
31
|
-
{ id: 'go', extensions: ['.go'] },
|
|
32
|
-
{ id: 'groovy', extensions: ['.groovy', '.gvy', '.gradle'] },
|
|
33
|
-
{ id: 'handlebars', extensions: ['.handlebars', '.hbs'] },
|
|
34
|
-
{ id: 'haskell', extensions: ['.hs', '.lhs'] },
|
|
35
|
-
{
|
|
36
|
-
id: 'html',
|
|
37
|
-
extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm', '.volt', '.vue'],
|
|
38
|
-
},
|
|
39
|
-
{ id: 'ini', extensions: ['.ini', '.conf'] },
|
|
40
|
-
{ id: 'properties', extensions: ['.properties', '.gitconfig', '.cfg', '.conf'] },
|
|
41
|
-
{ id: 'jade', extensions: ['.jade', '.pug'] },
|
|
42
|
-
{ id: 'java', extensions: ['.java', '.jav'] },
|
|
43
|
-
{ id: 'javascriptreact', extensions: ['.jsx'] },
|
|
44
|
-
{ id: 'javascript', extensions: ['.js', '.mjs', '.es6', '.cjs'] },
|
|
45
|
-
{
|
|
46
|
-
id: 'json',
|
|
47
|
-
extensions: ['.json', '.jsonc', '.bowerrc', '.jshintrc', '.jscsrc', '.eslintrc', '.babelrc', '.webmanifest'],
|
|
48
|
-
},
|
|
49
|
-
{ id: 'jsonc', extensions: ['.jsonc'] },
|
|
50
|
-
{ id: 'jsonc', extensions: ['.code-workspace'], filenames: ['.code-workspace'] },
|
|
51
|
-
{ id: 'julia', extensions: ['.jl'] },
|
|
52
|
-
{ id: 'jungle', extensions: ['.jungle'] },
|
|
53
|
-
{ id: 'less', extensions: ['.less'] },
|
|
54
|
-
{ id: 'lisp', extensions: ['.lisp', '.lsp', '.l', '.fasl'] },
|
|
55
|
-
{ id: 'literate haskell', extensions: ['.lhs'] },
|
|
56
|
-
{ id: 'lua', extensions: ['.lua'] },
|
|
57
|
-
{ id: 'makefile', extensions: ['.mk'], filenames: ['makefile'] },
|
|
58
|
-
{ id: 'markdown', extensions: ['.md', '.mdown', '.markdown', '.markdn'] },
|
|
59
|
-
{ id: 'mdx', extensions: ['.mdx'] },
|
|
60
|
-
{ id: 'monkeyc', extensions: ['.mc', '.mb'] },
|
|
61
|
-
{ id: 'objective-c', extensions: ['.m'] },
|
|
62
|
-
{ id: 'perl', extensions: ['.pl', '.pm', '.pod', '.t', '.PL', '.psgi'] },
|
|
63
|
-
{ id: 'perl6', extensions: ['.p6', '.pl6', '.pm6', '.nqp'] },
|
|
64
|
-
{ id: 'php', extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'] },
|
|
65
|
-
{ id: 'plaintext', extensions: ['.txt'] },
|
|
66
|
-
{ id: 'powershell', extensions: ['.ps1', '.psm1', '.psd1', '.pssc', '.psrc'] },
|
|
67
|
-
{ id: 'purescript', extensions: ['.purs'] },
|
|
68
|
-
{ id: 'python', extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'] },
|
|
69
|
-
{ id: 'r', extensions: ['.r', '.R', '.rhistory', '.rprofile', '.rt'] },
|
|
70
|
-
{ id: 'razor', extensions: ['.cshtml'] },
|
|
71
|
-
{ id: 'ruby', extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.rake', '.ru'] },
|
|
72
|
-
{ id: 'ruby', extensions: [], filenames: ['Gemfile'] },
|
|
73
|
-
{ id: 'rust', extensions: ['.rs'] },
|
|
74
|
-
{ id: 'scala', extensions: ['.scala', '.sc', '.sbt'] },
|
|
75
|
-
{ id: 'scss', extensions: ['.scss'] },
|
|
76
|
-
{ id: 'shaderlab', extensions: ['.shader', '.cginc'] },
|
|
77
|
-
{
|
|
78
|
-
id: 'shellscript',
|
|
79
|
-
extensions: [
|
|
80
|
-
'.sh',
|
|
81
|
-
'.bash',
|
|
82
|
-
'.bashrc',
|
|
83
|
-
'.bash_aliases',
|
|
84
|
-
'.bash_profile',
|
|
85
|
-
'.bash_login',
|
|
86
|
-
'.ebuild',
|
|
87
|
-
'.install',
|
|
88
|
-
'.profile',
|
|
89
|
-
'.bash_logout',
|
|
90
|
-
'.zsh',
|
|
91
|
-
'.zshrc',
|
|
92
|
-
'.zprofile',
|
|
93
|
-
'.zlogin',
|
|
94
|
-
'.zlogout',
|
|
95
|
-
'.zshenv',
|
|
96
|
-
'.zsh-theme',
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
{ id: 'sql', extensions: ['.sql', '.dsql'] },
|
|
100
|
-
{ id: 'svelte', extensions: ['.svelte'] },
|
|
101
|
-
{ id: 'swift', extensions: ['.swift'] },
|
|
102
|
-
{ id: 'toml', extensions: ['.toml'] },
|
|
103
|
-
{ id: 'terraform', extensions: ['.tf', '.tf.json'] },
|
|
104
|
-
{ id: 'tfvars', extensions: ['.tfvars'], description: 'Terraform Variables' },
|
|
105
|
-
{ id: 'typescript', extensions: ['.ts', '.cts', '.mts'] },
|
|
106
|
-
{ id: 'typescriptreact', extensions: ['.tsx'] },
|
|
107
|
-
{ id: 'vb', extensions: ['.vb', '.brs', '.vbs', '.bas'] },
|
|
108
|
-
{ id: 'vue', extensions: ['.vue'] },
|
|
109
|
-
{
|
|
110
|
-
id: 'xml',
|
|
111
|
-
extensions: [
|
|
112
|
-
'.ascx',
|
|
113
|
-
'.atom',
|
|
114
|
-
'.axml',
|
|
115
|
-
'.bpmn',
|
|
116
|
-
'.config',
|
|
117
|
-
'.cpt',
|
|
118
|
-
'.csl',
|
|
119
|
-
'.csproj.user',
|
|
120
|
-
'.csproj',
|
|
121
|
-
'.dita',
|
|
122
|
-
'.ditamap',
|
|
123
|
-
'.dtd',
|
|
124
|
-
'.dtml',
|
|
125
|
-
'.ent',
|
|
126
|
-
'.fsproj',
|
|
127
|
-
'.fxml',
|
|
128
|
-
'.iml',
|
|
129
|
-
'.isml',
|
|
130
|
-
'.jmx',
|
|
131
|
-
'.launch',
|
|
132
|
-
'.menu',
|
|
133
|
-
'.mod',
|
|
134
|
-
'.mxml',
|
|
135
|
-
'.nuspec',
|
|
136
|
-
'.opml',
|
|
137
|
-
'.owl',
|
|
138
|
-
'.proj',
|
|
139
|
-
'.pt',
|
|
140
|
-
'.pubxml.user',
|
|
141
|
-
'.pubxml',
|
|
142
|
-
'.rdf',
|
|
143
|
-
'.rng',
|
|
144
|
-
'.rss',
|
|
145
|
-
'.shproj',
|
|
146
|
-
'.storyboard',
|
|
147
|
-
'.svg',
|
|
148
|
-
'.targets',
|
|
149
|
-
'.tld',
|
|
150
|
-
'.tmx',
|
|
151
|
-
'.vbproj.user',
|
|
152
|
-
'.vbproj',
|
|
153
|
-
'.vcxproj.filters',
|
|
154
|
-
'.vcxproj',
|
|
155
|
-
'.wsdl',
|
|
156
|
-
'.wxi',
|
|
157
|
-
'.wxl',
|
|
158
|
-
'.wxs',
|
|
159
|
-
'.xaml',
|
|
160
|
-
'.xbl',
|
|
161
|
-
'.xib',
|
|
162
|
-
'.xlf',
|
|
163
|
-
'.xliff',
|
|
164
|
-
'.xml',
|
|
165
|
-
'.xoml',
|
|
166
|
-
'.xpdl',
|
|
167
|
-
'.xsd',
|
|
168
|
-
'.xul',
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{ id: 'wheel', extensions: ['.whl'], format: 'Binary' },
|
|
172
|
-
{ id: 'xsl', extensions: ['.xsl', '.xslt'] },
|
|
173
|
-
{ id: 'yaml', extensions: ['.eyaml', '.eyml', '.yaml', '.yml'] },
|
|
174
|
-
{ id: 'latex', extensions: ['.tex'] },
|
|
175
|
-
{ id: 'map', extensions: ['.map'] },
|
|
176
|
-
{ id: 'pdf', extensions: ['.pdf'] },
|
|
177
|
-
{ id: 'rsa', extensions: ['.pub'], filenames: ['id_rsa', 'id_rsa.pub'] },
|
|
178
|
-
{ id: 'pem', extensions: ['.private-key.pem', '.pem'] },
|
|
179
|
-
{ id: 'pem-private-key', extensions: ['.private-key.pem'] },
|
|
180
|
-
//
|
|
181
|
-
// Special file types used to prevent spell checking.
|
|
182
|
-
//
|
|
183
|
-
{
|
|
184
|
-
id: 'image',
|
|
185
|
-
extensions: [
|
|
186
|
-
'.bmp',
|
|
187
|
-
'.exr',
|
|
188
|
-
'.gif',
|
|
189
|
-
'.heic',
|
|
190
|
-
'.ico',
|
|
191
|
-
'.jpeg',
|
|
192
|
-
'.jpg',
|
|
193
|
-
'.pbm',
|
|
194
|
-
'.pgm',
|
|
195
|
-
'.png',
|
|
196
|
-
'.ppm',
|
|
197
|
-
'.ras',
|
|
198
|
-
'.sgi',
|
|
199
|
-
'.tiff',
|
|
200
|
-
'.webp',
|
|
201
|
-
'.xbm',
|
|
202
|
-
],
|
|
203
|
-
format: 'Binary',
|
|
204
|
-
description: 'Some image extensions',
|
|
205
|
-
},
|
|
206
|
-
// cspell:ignore woff
|
|
207
|
-
{
|
|
208
|
-
id: 'binary',
|
|
209
|
-
extensions: ['.gz', '.exe', '.dll', '.lib', '.obj', '.o', '.eot', '.cur', '.zip'],
|
|
210
|
-
format: 'Binary',
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: 'fonts',
|
|
214
|
-
extensions: ['.ttf', '.woff', '.woff2'],
|
|
215
|
-
format: 'Binary',
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: 'video',
|
|
219
|
-
extensions: ['.mov', '.mpg', '.mpeg', '.mp4', '.avi', '.wmv', '.mkv', '.flv'],
|
|
220
|
-
format: 'Binary',
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
id: 'lock',
|
|
224
|
-
extensions: ['.lock'],
|
|
225
|
-
filenames: ['package-lock.json'],
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
id: 'cache_files',
|
|
229
|
-
extensions: [],
|
|
230
|
-
// cspell:ignore eslintcache
|
|
231
|
-
filenames: ['.cspellcache', '.DS_Store', '.eslintcache'],
|
|
232
|
-
},
|
|
233
|
-
{ id: 'dll', extensions: ['.dll'], format: 'Binary' },
|
|
234
|
-
{ id: 'exe', extensions: ['.exe'], format: 'Binary' },
|
|
235
|
-
{ id: 'object-file', extensions: ['.o', '.obj'], format: 'Binary' },
|
|
236
|
-
{ id: 'jar', extensions: ['.jar'], format: 'Binary' },
|
|
237
|
-
{ id: 'spv', extensions: ['.spv'], format: 'Binary', description: 'SPSS Output Document' },
|
|
238
|
-
{ id: 'mdb', extensions: ['.mdb'], format: 'Binary', description: 'Microsoft Access DB' },
|
|
239
|
-
{ id: 'webm', extensions: ['.webm'], format: 'Binary', description: 'WebM is an audiovisual media file format.' },
|
|
240
|
-
{ id: 'trie', extensions: ['.trie'], format: 'Binary', description: 'CSpell dictionary file.' },
|
|
241
|
-
];
|
|
242
|
-
const binaryFormatIds = languageExtensionDefinitions.filter((d) => d.format === 'Binary').map((d) => d.id);
|
|
243
|
-
export const binaryLanguages = new Set(['binary', 'image', 'video', 'fonts', ...binaryFormatIds]);
|
|
244
|
-
export const generatedFiles = new Set([...binaryLanguages, 'map', 'lock', 'pdf', 'cache_files', 'rsa', 'pem', 'trie']);
|
|
245
|
-
export const languageIds = languageExtensionDefinitions.map(({ id }) => id);
|
|
246
|
-
const mapExtensionToSetOfLanguageIds = buildLanguageExtensionMapSet(languageExtensionDefinitions);
|
|
247
|
-
const mapExtensionToLanguageIds = buildExtensionToLanguageIdMap(mapExtensionToSetOfLanguageIds);
|
|
248
|
-
export function isBinaryExt(ext) {
|
|
249
|
-
return isBinary(getLanguagesForExt(ext));
|
|
250
|
-
}
|
|
251
|
-
export function isBinaryFile(basename) {
|
|
252
|
-
return isBinary(getLanguagesForBasename(basename));
|
|
253
|
-
}
|
|
254
|
-
export function isBinary(languageId) {
|
|
255
|
-
return doesSetContainAnyOf(binaryLanguages, languageId);
|
|
256
|
-
}
|
|
257
|
-
export function isGeneratedExt(ext) {
|
|
258
|
-
return isGenerated(getLanguagesForExt(ext));
|
|
259
|
-
}
|
|
260
|
-
export function isGeneratedFile(basename) {
|
|
261
|
-
return isGenerated(getLanguagesForBasename(basename));
|
|
262
|
-
}
|
|
263
|
-
export function isGenerated(languageId) {
|
|
264
|
-
return doesSetContainAnyOf(generatedFiles, languageId);
|
|
265
|
-
}
|
|
266
|
-
function doesSetContainAnyOf(setOfIds, languageId) {
|
|
267
|
-
if (typeof languageId === 'string') {
|
|
268
|
-
return setOfIds.has(languageId);
|
|
269
|
-
}
|
|
270
|
-
for (const id of languageId) {
|
|
271
|
-
if (setOfIds.has(id)) {
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
export function buildLanguageExtensionMapSet(defs) {
|
|
278
|
-
return defs.reduce((map, def) => {
|
|
279
|
-
function addId(value) {
|
|
280
|
-
autoResolve(map, value, () => new Set()).add(def.id);
|
|
281
|
-
}
|
|
282
|
-
def.extensions.forEach(addId);
|
|
283
|
-
def.filenames?.forEach(addId);
|
|
284
|
-
return map;
|
|
285
|
-
}, new Map());
|
|
286
|
-
}
|
|
287
|
-
function buildExtensionToLanguageIdMap(map) {
|
|
288
|
-
return new Map([...map].map(([k, s]) => [k, [...s]]));
|
|
289
|
-
}
|
|
290
|
-
function _getLanguagesForExt(ext) {
|
|
291
|
-
return mapExtensionToLanguageIds.get(ext) || mapExtensionToLanguageIds.get('.' + ext);
|
|
292
|
-
}
|
|
293
|
-
export function getLanguagesForExt(ext) {
|
|
294
|
-
return _getLanguagesForExt(ext) || _getLanguagesForExt(ext.toLowerCase()) || [];
|
|
295
|
-
}
|
|
296
|
-
function _getLanguagesForBasename(basename) {
|
|
297
|
-
const found = mapExtensionToLanguageIds.get(basename);
|
|
298
|
-
if (found)
|
|
299
|
-
return found;
|
|
300
|
-
for (let pos = basename.indexOf('.'); pos >= 0; pos = basename.indexOf('.', pos + 1)) {
|
|
301
|
-
const ids = mapExtensionToLanguageIds.get(basename.slice(pos));
|
|
302
|
-
if (ids)
|
|
303
|
-
return ids;
|
|
304
|
-
}
|
|
305
|
-
return undefined;
|
|
306
|
-
}
|
|
307
|
-
export function getLanguagesForBasename(basename) {
|
|
308
|
-
return _getLanguagesForBasename(basename) || _getLanguagesForBasename(basename.toLowerCase()) || [];
|
|
309
|
-
}
|
|
310
|
-
//# sourceMappingURL=LanguageIds.js.map
|