|
| 1 | +import * as monaco from 'monaco-editor' |
| 2 | +const configurationRegistry = monaco.extra.Registry.as<monaco.extra.IConfigurationRegistry>(monaco.extra.ConfigurationExtensions.Configuration) |
| 3 | + |
| 4 | +/** |
| 5 | + * comes from https://github.com/microsoft/vscode/blob/16d0a319b28caa4b6cf4e6801fd508282b7533e0/src/vs/workbench/contrib/files/browser/files.contribution.ts#L132 |
| 6 | + * files.exclude and files.associations are required by the Lua language server |
| 7 | + */ |
| 8 | +export const FILES_EXCLUDE_CONFIG = 'files.exclude' |
| 9 | +export const FILES_ASSOCIATIONS_CONFIG = 'files.associations' |
| 10 | +const isWeb = true |
| 11 | +const ConfigurationScope = monaco.extra.ConfigurationScope |
| 12 | +const nls = { |
| 13 | + localize: (key: string, defaultValue: string) => defaultValue |
| 14 | +} |
| 15 | +configurationRegistry.registerConfiguration({ |
| 16 | + id: 'files', |
| 17 | + order: 9, |
| 18 | + title: 'Files', |
| 19 | + type: 'object', |
| 20 | + properties: { |
| 21 | + 'files.eol': { |
| 22 | + type: 'string', |
| 23 | + enum: [ |
| 24 | + '\n', |
| 25 | + '\r\n', |
| 26 | + 'auto' |
| 27 | + ], |
| 28 | + enumDescriptions: [ |
| 29 | + nls.localize('eol.LF', 'LF'), |
| 30 | + nls.localize('eol.CRLF', 'CRLF'), |
| 31 | + nls.localize('eol.auto', 'Uses operating system specific end of line character.') |
| 32 | + ], |
| 33 | + default: 'auto', |
| 34 | + description: nls.localize('eol', 'The default end of line character.'), |
| 35 | + scope: ConfigurationScope.LANGUAGE_OVERRIDABLE |
| 36 | + }, |
| 37 | + [FILES_EXCLUDE_CONFIG]: { |
| 38 | + type: 'object', |
| 39 | + markdownDescription: nls.localize('exclude', 'Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting. Refer to the `#search.exclude#` setting to define search specific excludes. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).'), |
| 40 | + default: { |
| 41 | + ...{ '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true, '**/Thumbs.db': true }, |
| 42 | + ...(isWeb as boolean ? { '**/*.crswap': true /* filter out swap files used for local file access */ } : undefined) |
| 43 | + }, |
| 44 | + scope: ConfigurationScope.RESOURCE, |
| 45 | + additionalProperties: { |
| 46 | + anyOf: [ |
| 47 | + { |
| 48 | + type: 'boolean', |
| 49 | + description: nls.localize('files.exclude.boolean', 'The glob pattern to match file paths against. Set to true or false to enable or disable the pattern.') |
| 50 | + }, |
| 51 | + { |
| 52 | + type: 'object', |
| 53 | + properties: { |
| 54 | + when: { |
| 55 | + type: 'string', // expression ({ "**/*.js": { "when": "$(basename).js" } }) |
| 56 | + pattern: '\\w*\\$\\(basename\\)\\w*', |
| 57 | + default: '$(basename).ext', |
| 58 | + description: nls.localize('files.exclude.when', 'Additional check on the siblings of a matching file. Use $(basename) as variable for the matching file name.') |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | + ] |
| 63 | + } |
| 64 | + }, |
| 65 | + [FILES_ASSOCIATIONS_CONFIG]: { |
| 66 | + type: 'object', |
| 67 | + markdownDescription: nls.localize('associations', 'Configure file associations to languages (e.g. `"*.extension": "html"`). These have precedence over the default associations of the languages installed.'), |
| 68 | + additionalProperties: { |
| 69 | + type: 'string' |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | +}) |
0 commit comments