monaco.contribution.d.ts 4.0 KB

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