monaco.contribution.d.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { IEvent, IDisposable } from './fillers/monaco-editor-core';
  2. export interface HTMLFormatConfiguration {
  3. readonly tabSize: number;
  4. readonly insertSpaces: boolean;
  5. readonly wrapLineLength: number;
  6. readonly unformatted: string;
  7. readonly contentUnformatted: string;
  8. readonly indentInnerHtml: boolean;
  9. readonly preserveNewLines: boolean;
  10. readonly maxPreserveNewLines: number;
  11. readonly indentHandlebars: boolean;
  12. readonly endWithNewline: boolean;
  13. readonly extraLiners: string;
  14. readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
  15. }
  16. export interface CompletionConfiguration {
  17. readonly [providerId: string]: boolean;
  18. }
  19. export interface Options {
  20. /**
  21. * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
  22. */
  23. readonly format?: HTMLFormatConfiguration;
  24. /**
  25. * A list of known schemas and/or associations of schemas to file names.
  26. */
  27. readonly suggest?: CompletionConfiguration;
  28. /**
  29. * Configures the HTML data types known by the HTML langauge service.
  30. */
  31. readonly data?: HTMLDataConfiguration;
  32. }
  33. export interface ModeConfiguration {
  34. /**
  35. * Defines whether the built-in completionItemProvider is enabled.
  36. */
  37. readonly completionItems?: boolean;
  38. /**
  39. * Defines whether the built-in hoverProvider is enabled.
  40. */
  41. readonly hovers?: boolean;
  42. /**
  43. * Defines whether the built-in documentSymbolProvider is enabled.
  44. */
  45. readonly documentSymbols?: boolean;
  46. /**
  47. * Defines whether the built-in definitions provider is enabled.
  48. */
  49. readonly links?: boolean;
  50. /**
  51. * Defines whether the built-in references provider is enabled.
  52. */
  53. readonly documentHighlights?: boolean;
  54. /**
  55. * Defines whether the built-in rename provider is enabled.
  56. */
  57. readonly rename?: boolean;
  58. /**
  59. * Defines whether the built-in color provider is enabled.
  60. */
  61. readonly colors?: boolean;
  62. /**
  63. * Defines whether the built-in foldingRange provider is enabled.
  64. */
  65. readonly foldingRanges?: boolean;
  66. /**
  67. * Defines whether the built-in diagnostic provider is enabled.
  68. */
  69. readonly diagnostics?: boolean;
  70. /**
  71. * Defines whether the built-in selection range provider is enabled.
  72. */
  73. readonly selectionRanges?: boolean;
  74. /**
  75. * Defines whether the built-in documentFormattingEdit provider is enabled.
  76. */
  77. readonly documentFormattingEdits?: boolean;
  78. /**
  79. * Defines whether the built-in documentRangeFormattingEdit provider is enabled.
  80. */
  81. readonly documentRangeFormattingEdits?: boolean;
  82. }
  83. export interface LanguageServiceDefaults {
  84. readonly languageId: string;
  85. readonly modeConfiguration: ModeConfiguration;
  86. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  87. readonly options: Options;
  88. setOptions(options: Options): void;
  89. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  90. }
  91. export declare const htmlLanguageService: LanguageServiceRegistration;
  92. export declare const htmlDefaults: LanguageServiceDefaults;
  93. export declare const handlebarLanguageService: LanguageServiceRegistration;
  94. export declare const handlebarDefaults: LanguageServiceDefaults;
  95. export declare const razorLanguageService: LanguageServiceRegistration;
  96. export declare const razorDefaults: LanguageServiceDefaults;
  97. export interface LanguageServiceRegistration extends IDisposable {
  98. readonly defaults: LanguageServiceDefaults;
  99. }
  100. /**
  101. * Registers a new HTML language service for the languageId.
  102. * Note: 'html', 'handlebar' and 'razor' are registered by default.
  103. *
  104. * Use this method to register additional language ids with a HTML service.
  105. * The language server has to be registered before an editor model is opened.
  106. */
  107. export declare function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration;
  108. export interface HTMLDataConfiguration {
  109. /**
  110. * Defines whether the standard HTML tags and attributes are shown
  111. */
  112. readonly useDefaultDataProvider?: boolean;
  113. /**
  114. * Provides a set of custom data providers.
  115. */
  116. readonly dataProviders?: {
  117. [providerId: string]: HTMLDataV1;
  118. };
  119. }
  120. /**
  121. * Custom HTML tags attributes and attribute values
  122. * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md
  123. */
  124. export interface HTMLDataV1 {
  125. readonly version: 1 | 1.1;
  126. readonly tags?: ITagData[];
  127. readonly globalAttributes?: IAttributeData[];
  128. readonly valueSets?: IValueSet[];
  129. }
  130. export interface IReference {
  131. readonly name: string;
  132. readonly url: string;
  133. }
  134. export interface ITagData {
  135. readonly name: string;
  136. readonly description?: string | MarkupContent;
  137. readonly attributes: IAttributeData[];
  138. readonly references?: IReference[];
  139. }
  140. export interface IAttributeData {
  141. readonly name: string;
  142. readonly description?: string | MarkupContent;
  143. readonly valueSet?: string;
  144. readonly values?: IValueData[];
  145. readonly references?: IReference[];
  146. }
  147. export interface IValueData {
  148. readonly name: string;
  149. readonly description?: string | MarkupContent;
  150. readonly references?: IReference[];
  151. }
  152. export interface IValueSet {
  153. readonly name: string;
  154. readonly values: IValueData[];
  155. }
  156. export interface MarkupContent {
  157. readonly kind: MarkupKind;
  158. readonly value: string;
  159. }
  160. export declare type MarkupKind = 'plaintext' | 'markdown';