提交 b5136de0 编写于 作者: P pi1024e

Fixed changes and refactored so method structures in the file are same,...

Fixed changes and refactored so method structures in the file are same, allowing the new method to fit naturally.
上级 5b1d433a
......@@ -850,7 +850,7 @@ export class ExtensionEditor extends BaseEditor {
const contributes = manifest.contributes;
const colors = contributes && contributes.colors;
if (!colors || !colors.length) {
if (!(colors && colors.length)) {
return false;
}
......@@ -933,12 +933,12 @@ export class ExtensionEditor extends BaseEditor {
menus[context].forEach(menu => {
let command = byId[menu.command];
if (!command) {
if (command) {
command.menus.push(context);
} else {
command = { id: menu.command, title: '', keybindings: [], menus: [context] };
byId[command.id] = command;
commands.push(command);
} else {
command.menus.push(context);
}
});
});
......@@ -954,12 +954,12 @@ export class ExtensionEditor extends BaseEditor {
let command = byId[rawKeybinding.command];
if (!command) {
if (command) {
command.keybindings.push(keybinding);
} else {
command = { id: rawKeybinding.command, title: '', keybindings: [keybinding], menus: [] };
byId[command.id] = command;
commands.push(command);
} else {
command.keybindings.push(keybinding);
}
});
......@@ -1013,12 +1013,12 @@ export class ExtensionEditor extends BaseEditor {
grammars.forEach(grammar => {
let language = byId[grammar.language];
if (!language) {
if (language) {
language.hasGrammar = true;
} else {
language = { id: grammar.language, name: grammar.language, extensions: [], hasGrammar: true, hasSnippets: false };
byId[language.id] = language;
languages.push(language);
} else {
language.hasGrammar = true;
}
});
......@@ -1027,12 +1027,12 @@ export class ExtensionEditor extends BaseEditor {
snippets.forEach(snippet => {
let language = byId[snippet.language];
if (!language) {
if (language) {
language.hasSnippets = true;
} else {
language = { id: snippet.language, name: snippet.language, extensions: [], hasGrammar: false, hasSnippets: true };
byId[language.id] = language;
languages.push(language);
} else {
language.hasSnippets = true;
}
});
......@@ -1074,11 +1074,11 @@ export class ExtensionEditor extends BaseEditor {
}
const keyBinding = KeybindingParser.parseKeybinding(key || rawKeyBinding.key, OS);
if (!keyBinding) {
return null;
}
if (keyBinding) {
return this.keybindingService.resolveKeybinding(keyBinding)[0];
return this.keybindingService.resolveKeybinding(keyBinding)[0];
}
return null;
}
private loadContents<T>(loadingTask: () => CacheResult<T>): Promise<T> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册