json.d.ts 4.1 KB

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