mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Markers appear for wrong language id. Fixes Microsoft/monaco-editor#111
This commit is contained in:
parent
35fffade6a
commit
f0fdc683c1
3 changed files with 16 additions and 17 deletions
18
gulpfile.js
18
gulpfile.js
|
|
@ -31,16 +31,6 @@ gulp.task('release', ['clean-release','compile'], function() {
|
||||||
''
|
''
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
var jsoncLocation = __dirname + '/node_modules/jsonc-parser/lib';
|
|
||||||
if (!fs.existsSync(jsoncLocation)) {
|
|
||||||
var oldJsconcLocation = __dirname + '/node_modules/vscode-json-languageservice/node_modules/jsonc-parser/lib';
|
|
||||||
if (!fs.existsSync(oldJsconcLocation)) {
|
|
||||||
console.error('Unable to find jsonc node module at ' + jsoncLocation + ' or ' + oldJsconcLocation);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
jsoncLocation = oldJsconcLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDependencyLocation(name, libLocation, container) {
|
function getDependencyLocation(name, libLocation, container) {
|
||||||
var location = __dirname + '/node_modules/' + name + '/' + libLocation;
|
var location = __dirname + '/node_modules/' + name + '/' + libLocation;
|
||||||
if (!fs.existsSync(location)) {
|
if (!fs.existsSync(location)) {
|
||||||
|
|
@ -54,8 +44,8 @@ gulp.task('release', ['clean-release','compile'], function() {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uriLocation = getDependencyLocation('vscode-uri', 'lib', 'vscode-html-languageservice');
|
var jsoncLocation = getDependencyLocation('jsonc-parser', 'lib', 'vscode-json-languageservice');
|
||||||
|
var uriLocation = getDependencyLocation('vscode-uri', 'lib', 'vscode-json-languageservice');
|
||||||
|
|
||||||
function bundleOne(moduleId, exclude) {
|
function bundleOne(moduleId, exclude) {
|
||||||
|
|
||||||
|
|
@ -76,6 +66,10 @@ gulp.task('release', ['clean-release','compile'], function() {
|
||||||
name: 'vscode-languageserver-types',
|
name: 'vscode-languageserver-types',
|
||||||
location: __dirname + '/node_modules/vscode-languageserver-types/lib',
|
location: __dirname + '/node_modules/vscode-languageserver-types/lib',
|
||||||
main: 'main'
|
main: 'main'
|
||||||
|
}, {
|
||||||
|
name: 'vscode-uri',
|
||||||
|
location: uriLocation,
|
||||||
|
main: 'index'
|
||||||
}, {
|
}, {
|
||||||
name: 'jsonc-parser',
|
name: 'jsonc-parser',
|
||||||
location: jsoncLocation,
|
location: jsoncLocation,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-json",
|
"name": "monaco-json",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "JSON plugin for the Monaco Editor",
|
"description": "JSON plugin for the Monaco Editor",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "gulp compile",
|
"compile": "gulp compile",
|
||||||
|
|
@ -25,12 +25,12 @@
|
||||||
"gulp-tsb": "^2.0.0",
|
"gulp-tsb": "^2.0.0",
|
||||||
"gulp-uglify": "^1.5.3",
|
"gulp-uglify": "^1.5.3",
|
||||||
"merge-stream": "^1.0.0",
|
"merge-stream": "^1.0.0",
|
||||||
"monaco-editor-core": "^0.7.0",
|
"monaco-editor-core": "^0.7.3",
|
||||||
"monaco-languages": "^0.6.1",
|
"monaco-languages": "^0.6.1",
|
||||||
"object-assign": "^4.1.0",
|
"object-assign": "^4.1.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"typescript": "2.0.3",
|
"typescript": "2.0.3",
|
||||||
"vscode-json-languageservice": "^1.1.5-next.1",
|
"vscode-json-languageservice": "1.1.7",
|
||||||
"vscode-languageserver-types": "^1.0.1"
|
"vscode-languageserver-types": "1.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,12 @@ export class DiagnostcsAdapter {
|
||||||
|
|
||||||
const onModelRemoved = (model: monaco.editor.IModel): void => {
|
const onModelRemoved = (model: monaco.editor.IModel): void => {
|
||||||
monaco.editor.setModelMarkers(model, this._languageId, []);
|
monaco.editor.setModelMarkers(model, this._languageId, []);
|
||||||
delete this._listener[model.uri.toString()];
|
let uriStr = model.uri.toString();
|
||||||
|
let listener = this._listener[uriStr];
|
||||||
|
if (listener) {
|
||||||
|
listener.dispose();
|
||||||
|
delete this._listener[uriStr];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this._disposables.push(monaco.editor.onDidCreateModel(onModelAdd));
|
this._disposables.push(monaco.editor.onDidCreateModel(onModelAdd));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue