css.d.ts 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.css {
  6. export interface CSSFormatConfiguration {
  7. /** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */
  8. newlineBetweenSelectors?: boolean;
  9. /** add a new line after every css rule: Default: true */
  10. newlineBetweenRules?: boolean;
  11. /** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */
  12. spaceAroundSelectorSeparator?: boolean;
  13. /** put braces on the same line as rules (`collapse`), or put braces on own line, Allman / ANSI style (`expand`). Default `collapse` */
  14. braceStyle?: 'collapse' | 'expand';
  15. /** whether existing line breaks before elements should be preserved. Default: true */
  16. preserveNewLines?: boolean;
  17. /** maximum number of line breaks to be preserved in one chunk. Default: unlimited */
  18. maxPreserveNewLines?: number;
  19. }
  20. export interface Options {
  21. readonly validate?: boolean;
  22. readonly lint?: {
  23. readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error';
  24. readonly vendorPrefix?: 'ignore' | 'warning' | 'error';
  25. readonly duplicateProperties?: 'ignore' | 'warning' | 'error';
  26. readonly emptyRules?: 'ignore' | 'warning' | 'error';
  27. readonly importStatement?: 'ignore' | 'warning' | 'error';
  28. readonly boxModel?: 'ignore' | 'warning' | 'error';
  29. readonly universalSelector?: 'ignore' | 'warning' | 'error';
  30. readonly zeroUnits?: 'ignore' | 'warning' | 'error';
  31. readonly fontFaceProperties?: 'ignore' | 'warning' | 'error';
  32. readonly hexColorLength?: 'ignore' | 'warning' | 'error';
  33. readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error';
  34. readonly unknownProperties?: 'ignore' | 'warning' | 'error';
  35. readonly ieHack?: 'ignore' | 'warning' | 'error';
  36. readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error';
  37. readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error';
  38. readonly important?: 'ignore' | 'warning' | 'error';
  39. readonly float?: 'ignore' | 'warning' | 'error';
  40. readonly idSelector?: 'ignore' | 'warning' | 'error';
  41. };
  42. /**
  43. * Configures the CSS data types known by the langauge service.
  44. */
  45. readonly data?: CSSDataConfiguration;
  46. /**
  47. * Settings for the CSS formatter.
  48. */
  49. readonly format?: CSSFormatConfiguration;
  50. }
  51. export interface ModeConfiguration {
  52. /**
  53. * Defines whether the built-in completionItemProvider is enabled.
  54. */
  55. readonly completionItems?: boolean;
  56. /**
  57. * Defines whether the built-in hoverProvider is enabled.
  58. */
  59. readonly hovers?: boolean;
  60. /**
  61. * Defines whether the built-in documentSymbolProvider is enabled.
  62. */
  63. readonly documentSymbols?: boolean;
  64. /**
  65. * Defines whether the built-in definitions provider is enabled.
  66. */
  67. readonly definitions?: boolean;
  68. /**
  69. * Defines whether the built-in references provider is enabled.
  70. */
  71. readonly references?: boolean;
  72. /**
  73. * Defines whether the built-in references provider is enabled.
  74. */
  75. readonly documentHighlights?: boolean;
  76. /**
  77. * Defines whether the built-in rename provider is enabled.
  78. */
  79. readonly rename?: 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. * Defines whether the built-in document formatting edit provider is enabled.
  98. */
  99. readonly documentFormattingEdits?: boolean;
  100. /**
  101. * Defines whether the built-in document formatting range edit provider is enabled.
  102. */
  103. readonly documentRangeFormattingEdits?: boolean;
  104. }
  105. export interface LanguageServiceDefaults {
  106. readonly languageId: string;
  107. readonly onDidChange: IEvent<LanguageServiceDefaults>;
  108. readonly modeConfiguration: ModeConfiguration;
  109. readonly options: Options;
  110. setOptions(options: Options): void;
  111. setModeConfiguration(modeConfiguration: ModeConfiguration): void;
  112. /** @deprecated Use options instead */
  113. readonly diagnosticsOptions: DiagnosticsOptions;
  114. /** @deprecated Use setOptions instead */
  115. setDiagnosticsOptions(options: DiagnosticsOptions): void;
  116. }
  117. /** @deprecated Use Options instead */
  118. export type DiagnosticsOptions = Options;
  119. export const cssDefaults: LanguageServiceDefaults;
  120. export const scssDefaults: LanguageServiceDefaults;
  121. export const lessDefaults: LanguageServiceDefaults;
  122. export interface CSSDataConfiguration {
  123. /**
  124. * Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown.
  125. */
  126. useDefaultDataProvider?: boolean;
  127. /**
  128. * Provides a set of custom data providers.
  129. */
  130. dataProviders?: {
  131. [providerId: string]: CSSDataV1;
  132. };
  133. }
  134. /**
  135. * Custom CSS properties, at-directives, pseudoClasses and pseudoElements
  136. * https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md
  137. */
  138. export interface CSSDataV1 {
  139. version: 1 | 1.1;
  140. properties?: IPropertyData[];
  141. atDirectives?: IAtDirectiveData[];
  142. pseudoClasses?: IPseudoClassData[];
  143. pseudoElements?: IPseudoElementData[];
  144. }
  145. export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
  146. export interface IReference {
  147. name: string;
  148. url: string;
  149. }
  150. export interface IPropertyData {
  151. name: string;
  152. description?: string | MarkupContent;
  153. browsers?: string[];
  154. restrictions?: string[];
  155. status?: EntryStatus;
  156. syntax?: string;
  157. values?: IValueData[];
  158. references?: IReference[];
  159. relevance?: number;
  160. }
  161. export interface IAtDirectiveData {
  162. name: string;
  163. description?: string | MarkupContent;
  164. browsers?: string[];
  165. status?: EntryStatus;
  166. references?: IReference[];
  167. }
  168. export interface IPseudoClassData {
  169. name: string;
  170. description?: string | MarkupContent;
  171. browsers?: string[];
  172. status?: EntryStatus;
  173. references?: IReference[];
  174. }
  175. export interface IPseudoElementData {
  176. name: string;
  177. description?: string | MarkupContent;
  178. browsers?: string[];
  179. status?: EntryStatus;
  180. references?: IReference[];
  181. }
  182. export interface IValueData {
  183. name: string;
  184. description?: string | MarkupContent;
  185. browsers?: string[];
  186. status?: EntryStatus;
  187. references?: IReference[];
  188. }
  189. export interface MarkupContent {
  190. kind: MarkupKind;
  191. value: string;
  192. }
  193. export type MarkupKind = 'plaintext' | 'markdown';
  194. }