monaco.d.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. /// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />
  6. declare namespace monaco.languages.json {
  7. export interface DiagnosticsOptions {
  8. /**
  9. * If set, the validator will be enabled and perform syntax and schema based validation,
  10. * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`.
  11. */
  12. readonly validate?: boolean;
  13. /**
  14. * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
  15. * `DiagnosticsOptions.allowComments` will override this setting.
  16. */
  17. readonly allowComments?: boolean;
  18. /**
  19. * A list of known schemas and/or associations of schemas to file names.
  20. */
  21. readonly schemas?: {
  22. /**
  23. * The URI of the schema, which is also the identifier of the schema.
  24. */
  25. readonly uri: string;
  26. /**
  27. * A list of glob patterns that describe for which file URIs the JSON schema will be used.
  28. * '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
  29. * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
  30. * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
  31. */
  32. readonly fileMatch?: string[];
  33. /**
  34. * The schema for the given URI.
  35. */
  36. readonly schema?: any;
  37. }[];
  38. /**
  39. * If set, the schema service would load schema content on-demand with 'fetch' if available
  40. */
  41. readonly enableSchemaRequest?: boolean;
  42. /**
  43. * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
  44. */
  45. readonly schemaValidation?: SeverityLevel;
  46. /**
  47. * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used.
  48. */
  49. readonly schemaRequest?: SeverityLevel;
  50. /**
  51. * The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
  52. */
  53. readonly trailingCommas?: SeverityLevel;
  54. /**
  55. * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors.
  56. */
  57. readonly comments?: SeverityLevel;
  58. }
  59. export type SeverityLevel = 'error' | 'warning' | 'ignore';
  60. export interface ModeConfiguration {
  61. /**
  62. * Defines whether the built-in documentFormattingEdit provider is enabled.
  63. */
  64. readonly documentFormattingEdits?: boolean;
  65. /**
  66. * Defines whether the built-in documentRangeFormattingEdit provider is enabled.
  67. */
  68. readonly documentRangeFormattingEdits?: boolean;
  69. /**
  70. * Defines whether the built-in completionItemProvider is enabled.
  71. */
  72. readonly completionItems?: boolean;
  73. /**
  74. * Defines whether the built-in hoverProvider is enabled.
  75. */
  76. readonly hovers?: boolean;
  77. /**
  78. * Defines whether the built-in documentSymbolProvider is enabled.
  79. */
  80. readonly documentSymbols?: boolean;
  81. /**
  82. * Defines whether the built-in tokens provider is enabled.
  83. */
  84. readonly tokens?: boolean;
  85. /**
  86. * Defines whether the built-in color provider is enabled.
  87. */
  88. readonly colors?: boolean;
  89. /**
  90. * Defines whether the built-in foldingRange provider is enabled.
  91. */
  92. readonly foldingRanges?: boolean;
  93. /**
  94. * Defines whether the built-in diagnostic provider is enabled.
  95. */
  96. readonly diagnostics?: boolean;
  97. /**
  98. * Defines whether the built-in selection range provider is enabled.
  99. */
  100. readonly selectionRanges?: boolean;
  101. }
  102. export interface LanguageServiceDefaults {
  103. readonly languageId: string;
  104. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  105. readonly diagnosticsOptions: DiagnosticsOptions;
  106. readonly modeConfiguration: ModeConfiguration;
  107. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  108. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  109. }
  110. export const jsonDefaults: LanguageServiceDefaults;
  111. }