mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
1.0
This commit is contained in:
parent
ad61b15585
commit
ef359fa044
8 changed files with 60 additions and 62 deletions
|
|
@ -5,5 +5,4 @@
|
|||
/test/
|
||||
/release/dev/
|
||||
/gulpfile.js
|
||||
/tsconfig.json
|
||||
/.npmignore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# monaco-css
|
||||
CSS language support for the Monaco Editor.
|
||||
# Monaco CSS
|
||||
|
||||
CSS language plugin for the Monaco Editor.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
|
|
|
|||
15
package.json
15
package.json
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "monaco-css",
|
||||
"version": "0.0.1",
|
||||
"description": "CSS, LESS and SCSS support for Monaco Editor",
|
||||
"version": "1.0.0",
|
||||
"description": "CSS, LESS and SCSS plugin for the Monaco Editor",
|
||||
"scripts": {
|
||||
"test": "node_modules/.bin/mocha",
|
||||
"watch": "node_modules/.bin/gulp watch",
|
||||
"prepublish": "node_modules/.bin/gulp release"
|
||||
"compile": "gulp compile",
|
||||
"watch": "gulp watch",
|
||||
"prepublish": "gulp release"
|
||||
},
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
"url": "https://github.com/Microsoft/monaco-css/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "file:../vscode-css-languageservice",
|
||||
"vscode-languageserver-types": "1.0.0"
|
||||
"vscode-css-languageservice": "^1.0.1",
|
||||
"vscode-languageserver-types": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"event-stream": "^3.3.2",
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
"gulp-tsb": "^1.10.4",
|
||||
"gulp-uglify": "^1.5.3",
|
||||
"merge-stream": "^1.0.0",
|
||||
"mocha": "^2.5.3",
|
||||
"monaco-editor-core": "^0.4.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"rimraf": "^2.5.2",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import Promise = monaco.Promise;
|
|||
import Uri = monaco.Uri;
|
||||
import IDisposable = monaco.IDisposable;
|
||||
|
||||
export function setupMode(defaults:LanguageServiceDefaultsImpl): void {
|
||||
export function setupMode(defaults: LanguageServiceDefaultsImpl): void {
|
||||
|
||||
let disposables: IDisposable[] = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ export class CSSWorker {
|
|||
|
||||
// --- model sync -----------------------
|
||||
|
||||
private _languageService : cssService.LanguageService;
|
||||
private _languageService: cssService.LanguageService;
|
||||
private _languageSettings: cssService.LanguageSettings;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(createData:ICreateData) {
|
||||
constructor(createData: ICreateData) {
|
||||
this._languageSettings = createData.languageSettings;
|
||||
this._languageId = createData.languageId;
|
||||
switch (this._languageId) {
|
||||
|
|
@ -98,7 +98,7 @@ export class CSSWorker {
|
|||
let renames = this._languageService.doRename(document, position, newName, stylesheet);
|
||||
return Promise.as(renames);
|
||||
}
|
||||
private _getTextDocument(uri:string): ls.TextDocument {
|
||||
private _getTextDocument(uri: string): ls.TextDocument {
|
||||
let models = monaco.worker.getMirrorModels();
|
||||
for (let model of models) {
|
||||
if (model.uri.toString() === uri) {
|
||||
|
|
@ -114,6 +114,6 @@ export interface ICreateData {
|
|||
languageSettings: cssService.LanguageSettings;
|
||||
}
|
||||
|
||||
export function create(createData:ICreateData): CSSWorker {
|
||||
export function create(createData: ICreateData): CSSWorker {
|
||||
return new CSSWorker(createData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,28 +135,27 @@ function toRange(range: ls.Range): Range {
|
|||
}
|
||||
|
||||
function toCompletionItemKind(kind: number): monaco.languages.CompletionItemKind {
|
||||
let lsItemKind = ls.CompletionItemKind;
|
||||
let mItemKind = monaco.languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case lsItemKind.Text: return mItemKind.Text;
|
||||
case lsItemKind.Method: return mItemKind.Method;
|
||||
case lsItemKind.Function: return mItemKind.Function;
|
||||
case lsItemKind.Constructor: return mItemKind.Constructor;
|
||||
case lsItemKind.Field: return mItemKind.Field;
|
||||
case lsItemKind.Variable: return mItemKind.Variable;
|
||||
case lsItemKind.Class: return mItemKind.Class;
|
||||
case lsItemKind.Interface: return mItemKind.Interface;
|
||||
case lsItemKind.Module: return mItemKind.Module;
|
||||
case lsItemKind.Property: return mItemKind.Property;
|
||||
case lsItemKind.Unit: return mItemKind.Unit;
|
||||
case lsItemKind.Value: return mItemKind.Value;
|
||||
case lsItemKind.Enum: return mItemKind.Enum;
|
||||
case lsItemKind.Keyword: return mItemKind.Keyword;
|
||||
case lsItemKind.Snippet: return mItemKind.Snippet;
|
||||
case lsItemKind.Color: return mItemKind.Color;
|
||||
case lsItemKind.File: return mItemKind.File;
|
||||
case lsItemKind.Reference: return mItemKind.Reference;
|
||||
case ls.CompletionItemKind.Text: return mItemKind.Text;
|
||||
case ls.CompletionItemKind.Method: return mItemKind.Method;
|
||||
case ls.CompletionItemKind.Function: return mItemKind.Function;
|
||||
case ls.CompletionItemKind.Constructor: return mItemKind.Constructor;
|
||||
case ls.CompletionItemKind.Field: return mItemKind.Field;
|
||||
case ls.CompletionItemKind.Variable: return mItemKind.Variable;
|
||||
case ls.CompletionItemKind.Class: return mItemKind.Class;
|
||||
case ls.CompletionItemKind.Interface: return mItemKind.Interface;
|
||||
case ls.CompletionItemKind.Module: return mItemKind.Module;
|
||||
case ls.CompletionItemKind.Property: return mItemKind.Property;
|
||||
case ls.CompletionItemKind.Unit: return mItemKind.Unit;
|
||||
case ls.CompletionItemKind.Value: return mItemKind.Value;
|
||||
case ls.CompletionItemKind.Enum: return mItemKind.Enum;
|
||||
case ls.CompletionItemKind.Keyword: return mItemKind.Keyword;
|
||||
case ls.CompletionItemKind.Snippet: return mItemKind.Snippet;
|
||||
case ls.CompletionItemKind.Color: return mItemKind.Color;
|
||||
case ls.CompletionItemKind.File: return mItemKind.File;
|
||||
case ls.CompletionItemKind.Reference: return mItemKind.Reference;
|
||||
}
|
||||
return mItemKind.Property;
|
||||
}
|
||||
|
|
@ -382,28 +381,27 @@ export class RenameAdapter implements monaco.languages.RenameProvider {
|
|||
// --- document symbols ------
|
||||
|
||||
function toSymbolKind(kind: ls.SymbolKind): monaco.languages.SymbolKind {
|
||||
let lsKind = ls.SymbolKind;
|
||||
let mKind = monaco.languages.SymbolKind;
|
||||
|
||||
switch (kind) {
|
||||
case lsKind.File: return mKind.Array;
|
||||
case lsKind.Module: return mKind.Module;
|
||||
case lsKind.Namespace: return mKind.Namespace;
|
||||
case lsKind.Package: return mKind.Package;
|
||||
case lsKind.Class: return mKind.Class;
|
||||
case lsKind.Method: return mKind.Method;
|
||||
case lsKind.Property: return mKind.Property;
|
||||
case lsKind.Field: return mKind.Field;
|
||||
case lsKind.Constructor: return mKind.Constructor;
|
||||
case lsKind.Enum: return mKind.Enum;
|
||||
case lsKind.Interface: return mKind.Interface;
|
||||
case lsKind.Function: return mKind.Function;
|
||||
case lsKind.Variable: return mKind.Variable;
|
||||
case lsKind.Constant: return mKind.Constant;
|
||||
case lsKind.String: return mKind.String;
|
||||
case lsKind.Number: return mKind.Number;
|
||||
case lsKind.Boolean: return mKind.Boolean;
|
||||
case lsKind.Array: return mKind.Array;
|
||||
case ls.SymbolKind.File: return mKind.Array;
|
||||
case ls.SymbolKind.Module: return mKind.Module;
|
||||
case ls.SymbolKind.Namespace: return mKind.Namespace;
|
||||
case ls.SymbolKind.Package: return mKind.Package;
|
||||
case ls.SymbolKind.Class: return mKind.Class;
|
||||
case ls.SymbolKind.Method: return mKind.Method;
|
||||
case ls.SymbolKind.Property: return mKind.Property;
|
||||
case ls.SymbolKind.Field: return mKind.Field;
|
||||
case ls.SymbolKind.Constructor: return mKind.Constructor;
|
||||
case ls.SymbolKind.Enum: return mKind.Enum;
|
||||
case ls.SymbolKind.Interface: return mKind.Interface;
|
||||
case ls.SymbolKind.Function: return mKind.Function;
|
||||
case ls.SymbolKind.Variable: return mKind.Variable;
|
||||
case ls.SymbolKind.Constant: return mKind.Constant;
|
||||
case ls.SymbolKind.String: return mKind.String;
|
||||
case ls.SymbolKind.Number: return mKind.Number;
|
||||
case ls.SymbolKind.Boolean: return mKind.Boolean;
|
||||
case ls.SymbolKind.Array: return mKind.Array;
|
||||
}
|
||||
return mKind.Function;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import Emitter = monaco.Emitter;
|
|||
import IEvent = monaco.IEvent;
|
||||
import IDisposable = monaco.IDisposable;
|
||||
|
||||
declare var require:<T>(moduleId:[string], callback:(module:T)=>void)=>void;
|
||||
declare var require: <T>(moduleId: [string], callback: (module: T) => void) => void;
|
||||
|
||||
// --- CSS configuration and defaults ---------
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.css.Languag
|
|||
this.setDiagnosticsOptions(diagnosticsOptions);
|
||||
}
|
||||
|
||||
get onDidChange(): IEvent<monaco.languages.css.LanguageServiceDefaults>{
|
||||
get onDidChange(): IEvent<monaco.languages.css.LanguageServiceDefaults> {
|
||||
return this._onDidChange.event;
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.css.Languag
|
|||
}
|
||||
}
|
||||
|
||||
const diagnosticDefault : monaco.languages.css.DiagnosticsOptions = {
|
||||
const diagnosticDefault: monaco.languages.css.DiagnosticsOptions = {
|
||||
validate: true,
|
||||
lint: {
|
||||
compatibleVendorPrefixes: 'ignore',
|
||||
|
|
@ -84,7 +84,7 @@ monaco.languages.css = createAPI();
|
|||
|
||||
// --- Registration to monaco editor ---
|
||||
|
||||
function withMode(callback:(module:typeof mode)=>void): void {
|
||||
function withMode(callback: (module: typeof mode) => void): void {
|
||||
require<typeof mode>(['vs/language/css/cssMode'], callback);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export class WorkerManager {
|
|||
}
|
||||
|
||||
getLanguageServiceWorker(...resources: Uri[]): Promise<CSSWorker> {
|
||||
let _client:CSSWorker;
|
||||
let _client: CSSWorker;
|
||||
return toShallowCancelPromise(
|
||||
this._getClient().then((client) => {
|
||||
_client = client
|
||||
|
|
@ -89,9 +89,9 @@ export class WorkerManager {
|
|||
}
|
||||
}
|
||||
|
||||
function toShallowCancelPromise<T>(p:Promise<T>): Promise<T> {
|
||||
let completeCallback: (value:T)=>void;
|
||||
let errorCallback: (err:any)=>void;
|
||||
function toShallowCancelPromise<T>(p: Promise<T>): Promise<T> {
|
||||
let completeCallback: (value: T) => void;
|
||||
let errorCallback: (err: any) => void;
|
||||
|
||||
let r = new Promise<T>((c, e) => {
|
||||
completeCallback = c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue