vscode-css-languageservice
Advanced tools
Comparing version 4.3.6 to 4.4.0
@@ -0,3 +1,5 @@ | ||
4.4.0 - 2020-11-30 | ||
=================== | ||
* New parameter `HoverSettings` for `LanguageService.doHover`: Defines whether the hover contains element documentation and/or a reference to MDN. | ||
4.3.0 - 2020-06-26 | ||
@@ -4,0 +6,0 @@ =================== |
@@ -1,2 +0,2 @@ | ||
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1 } from './cssLanguageTypes'; | ||
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings } from './cssLanguageTypes'; | ||
export declare type Stylesheet = {}; | ||
@@ -12,3 +12,3 @@ export * from './cssLanguageTypes'; | ||
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void; | ||
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet): Hover | null; | ||
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null; | ||
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null; | ||
@@ -15,0 +15,0 @@ findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[]; |
@@ -16,2 +16,6 @@ import { Range, Position, DocumentUri, MarkupContent, MarkupKind } from 'vscode-languageserver-types'; | ||
} | ||
export interface HoverSettings { | ||
documentation?: boolean; | ||
references?: boolean; | ||
} | ||
export interface PropertyCompletionContext { | ||
@@ -18,0 +22,0 @@ propertyName: string; |
@@ -26,3 +26,3 @@ /*--------------------------------------------------------------------------------------------- | ||
} | ||
export function getEntryDescription(entry, doesSupportMarkdown) { | ||
export function getEntryDescription(entry, doesSupportMarkdown, settings) { | ||
var result; | ||
@@ -32,3 +32,3 @@ if (doesSupportMarkdown) { | ||
kind: 'markdown', | ||
value: getEntryMarkdownDescription(entry) | ||
value: getEntryMarkdownDescription(entry, settings) | ||
}; | ||
@@ -39,3 +39,3 @@ } | ||
kind: 'plaintext', | ||
value: getEntryStringDescription(entry) | ||
value: getEntryStringDescription(entry, settings) | ||
}; | ||
@@ -52,3 +52,3 @@ } | ||
} | ||
function getEntryStringDescription(entry) { | ||
function getEntryStringDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -61,15 +61,19 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -81,3 +85,3 @@ return r.name + ": " + r.url; | ||
} | ||
function getEntryMarkdownDescription(entry) { | ||
function getEntryMarkdownDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -87,16 +91,20 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -103,0 +111,0 @@ return "[" + r.name + "](" + r.url + ")"; |
@@ -18,3 +18,3 @@ /*--------------------------------------------------------------------------------------------- | ||
} | ||
CSSHover.prototype.doHover = function (document, position, stylesheet) { | ||
CSSHover.prototype.doHover = function (document, position, stylesheet, settings) { | ||
function getRange(node) { | ||
@@ -55,3 +55,3 @@ return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -73,3 +73,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -93,3 +93,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -96,0 +96,0 @@ hover = { |
@@ -1,2 +0,2 @@ | ||
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1 } from './cssLanguageTypes'; | ||
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings } from './cssLanguageTypes'; | ||
export declare type Stylesheet = {}; | ||
@@ -12,3 +12,3 @@ export * from './cssLanguageTypes'; | ||
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void; | ||
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet): Hover | null; | ||
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null; | ||
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null; | ||
@@ -15,0 +15,0 @@ findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[]; |
@@ -16,2 +16,6 @@ import { Range, Position, DocumentUri, MarkupContent, MarkupKind } from 'vscode-languageserver-types'; | ||
} | ||
export interface HoverSettings { | ||
documentation?: boolean; | ||
references?: boolean; | ||
} | ||
export interface PropertyCompletionContext { | ||
@@ -18,0 +22,0 @@ propertyName: string; |
@@ -37,3 +37,3 @@ (function (factory) { | ||
} | ||
function getEntryDescription(entry, doesSupportMarkdown) { | ||
function getEntryDescription(entry, doesSupportMarkdown, settings) { | ||
var result; | ||
@@ -43,3 +43,3 @@ if (doesSupportMarkdown) { | ||
kind: 'markdown', | ||
value: getEntryMarkdownDescription(entry) | ||
value: getEntryMarkdownDescription(entry, settings) | ||
}; | ||
@@ -50,3 +50,3 @@ } | ||
kind: 'plaintext', | ||
value: getEntryStringDescription(entry) | ||
value: getEntryStringDescription(entry, settings) | ||
}; | ||
@@ -65,3 +65,3 @@ } | ||
exports.textToMarkedString = textToMarkedString; | ||
function getEntryStringDescription(entry) { | ||
function getEntryStringDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -74,15 +74,19 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -94,3 +98,3 @@ return r.name + ": " + r.url; | ||
} | ||
function getEntryMarkdownDescription(entry) { | ||
function getEntryMarkdownDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -100,16 +104,20 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -116,0 +124,0 @@ return "[" + r.name + "](" + r.url + ")"; |
@@ -29,3 +29,3 @@ (function (factory) { | ||
} | ||
CSSHover.prototype.doHover = function (document, position, stylesheet) { | ||
CSSHover.prototype.doHover = function (document, position, stylesheet, settings) { | ||
function getRange(node) { | ||
@@ -66,3 +66,3 @@ return cssLanguageTypes_1.Range.create(document.positionAt(node.offset), document.positionAt(node.end)); | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -84,3 +84,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -104,3 +104,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -107,0 +107,0 @@ hover = { |
{ | ||
"name": "vscode-css-languageservice", | ||
"version": "4.3.6", | ||
"version": "4.4.0", | ||
"description": "Language service for CSS, LESS and SCSS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/cssLanguageService.js", |
2890717
68105