Skip to content

Commit

Permalink
Version 5.0.2 of Qooxdoo
Browse files Browse the repository at this point in the history
  • Loading branch information
JBaron committed Aug 7, 2017
1 parent fe43bfa commit bc3fd47
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 241 deletions.
53 changes: 29 additions & 24 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ var Cats;
base: true,
style: function (states) {
return {
backgroundColor: undefined,
backgroundColor: undefined
};
}
},
"toolbar": {
base: true,
style: function (states) {
return {
backgroundColor: undefined,
backgroundColor: undefined
};
}
},
Expand Down Expand Up @@ -443,7 +443,7 @@ var Cats;
}
Cats.Attribute = Attribute;
;
var Severity;
let Severity;
(function (Severity) {
Severity[Severity["Info"] = "info"] = "Info";
Severity[Severity["Warning"] = "warning"] = "Warning";
Expand Down Expand Up @@ -671,7 +671,7 @@ var Cats;
var char = IDE.project.config.codeFormat.NewLineCharacter;
if (char) return char;
} catch (exp) {}
if (isWindows()) return "\r\n";
return "\n";
*/
Expand Down Expand Up @@ -811,23 +811,28 @@ var Cats;
this.setTheme(this.config.theme);
}
loadShortCuts() {
var fileName = Cats.OS.File.join(this.catsHomeDir, "resource/shortcuts.json");
var c = Cats.OS.File.readTextFile(fileName);
var shortCutSets = JSON.parse(c);
var os = "linux";
if (Cats.OS.File.isWindows()) {
os = "win";
}
else if (Cats.OS.File.isOSX()) {
os = "osx";
try {
var fileName = Cats.OS.File.join(this.catsHomeDir, "resource/shortcuts.json");
var c = Cats.OS.File.readTextFile(fileName);
var shortCutSets = JSON.parse(c);
var os = "linux";
if (Cats.OS.File.isWindows()) {
os = "win";
}
else if (Cats.OS.File.isOSX()) {
os = "osx";
}
var shortCuts = shortCutSets[os];
for (var shortCut in shortCuts) {
var commandName = shortCuts[shortCut];
var cmd = new qx.ui.command.Command(shortCut);
cmd.addListener("execute", (function (commandName) {
Cats.Commands.commandRegistry.runCommand(commandName);
}).bind(null, commandName));
}
}
var shortCuts = shortCutSets[os];
for (var shortCut in shortCuts) {
var commandName = shortCuts[shortCut];
var cmd = new qx.ui.command.Command(shortCut);
cmd.addListener("execute", (function (commandName) {
Cats.Commands.commandRegistry.runCommand(commandName);
}).bind(null, commandName));
catch (err) {
console.error("Error loading shortcuts" + err);
}
}
/**
Expand Down Expand Up @@ -861,12 +866,12 @@ var Cats;
var colors = manager.getTheme()["colors"];
var jcolors = JSON.stringify(colors.__proto__,null,4);
IDE.console.log(jcolors);
var editor = new Gui.Editor.SourceEditor();
IDE.editorTabView.addEditor(editor,{row:0, column:0});
editor.setContent(jcolors);
editor.setMode("ace/mode/json");
IDE.console.log(jcolors);
for (var c in colors) {
var dyn = manager.isDynamic(c);
Expand Down Expand Up @@ -1895,7 +1900,7 @@ var Cats;
/**
* List of known commands
*/
var COMMANDNAME;
let COMMANDNAME;
(function (COMMANDNAME) {
COMMANDNAME[COMMANDNAME["help_devTools"] = 0] = "help_devTools";
COMMANDNAME[COMMANDNAME["help_shortcuts"] = 1] = "help_shortcuts";
Expand Down Expand Up @@ -6181,7 +6186,7 @@ var Cats;
if (this.form.validate()) {
var param = {
name: s.getValue(),
caseInsensitive: c.getValue(),
caseInsensitive: c.getValue()
};
// this.run(param);
}
Expand Down
204 changes: 6 additions & 198 deletions lib/tsworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var Cats;
}
Cats.Attribute = Attribute;
;
var Severity;
let Severity;
(function (Severity) {
Severity[Severity["Info"] = "info"] = "Info";
Severity[Severity["Warning"] = "warning"] = "Warning";
Expand Down Expand Up @@ -221,26 +221,26 @@ var Cats;
var middle = newText;
var suffix = this.content.substring(limChar);
this.setContent(prefix + middle + suffix);
// Store edit range + new length of script
this.editRanges.push({
length: this.content.length,
textChangeRange: new ts.TextChangeRange(
ts.TextSpan.fromBounds(minChar, limChar), newText.length)
});
// Update version #
this.version++;
}
public getTextChangeRangeSinceVersion(version: number): ts.TextChangeRange {
if (this.version === version) {
// No edits!
return ts.TextChangeRange.unchanged;
}
var initialEditRangeIndex = this.editRanges.length - (this.version - version);
var entries = this.editRanges.slice(initialEditRangeIndex);
return ts.TextChangeRange.collapseChangesAcrossMultipleVersions(entries.map(e => e.textChangeRange));
}
Expand Down Expand Up @@ -554,35 +554,6 @@ var Cats;
return null;
}
}
/**
* Create a Class Model for project that can be used for example in the
* UML viewer.
*/
getObjectModel() {
//Force all symbols to be created.
this.getAllDiagnostics();
var mc = new TSWorker.ModelCreator();
this.lsHost.getScriptFileNames().forEach((scriptName) => {
if (scriptName.indexOf("lib.d.ts") > 0)
return;
var script = this.lsHost.getScript(scriptName);
// var doc:ts.SourceFile = ts.createSourceFile(scriptName, script.getContent(),
// this.lsHost.getCompilationSettings().target, script.getVersion());
/*
var doc = this.documentRegistry.acquireDocument(
scriptName,
this.lsHost.getCompilationSettings(),
script.getScriptSnapshot(),
script.getVersion(),
script.isOpen()
);
*/
var doc = script.getSourceFile();
mc.parse(doc);
this.documentRegistry.releaseDocument(scriptName, this.lsHost.getCompilationSettings());
});
return mc.getModel();
}
/**
* Convert Services to Cats NavigateToItems
*/
Expand Down Expand Up @@ -891,166 +862,3 @@ var Cats;
}, false);
})(TSWorker = Cats.TSWorker || (Cats.TSWorker = {}));
})(Cats || (Cats = {}));
// Copyright (c) JBaron. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
var Cats;
(function (Cats) {
var TSWorker;
(function (TSWorker) {
/**
* Creates a class model to be used for displaying as an UML diagram
*
* @TODO Fix this using the new language service API. Right now only partially functioning.
*
*/
class ModelCreator {
constructor() {
this.model = {};
}
getModel() {
var result = [];
Object.keys(this.model).forEach((key) => {
var entry = this.model[key];
result.push(entry);
});
return result;
}
parse(doc) {
this.last = null;
this.handle(doc);
}
handle(node) {
if (!node)
return;
try {
if (this.isTopLevelNode(node.kind)) {
this.last = this.createIfNotExist(node);
}
if (this.interest(node.kind)) {
var fullName = node.name; // symbol;
// var fullName = s ? s.getName() : node.id;
// console.log(this.interest(node.kind) + ":" + node.name + ":" + fullName) ;
}
if (node.kind === ts.SyntaxKind.MethodDeclaration) {
if (this.last)
this.last.operations.push(node.name["text"]);
return;
}
if (node.kind === ts.SyntaxKind.Constructor) {
if (this.last)
this.last.operations.push("constructor");
return;
}
if (node.kind === ts.SyntaxKind.PropertyDeclaration) {
if (this.last) {
var attr = {
name: node.name["text"],
modifiers: [],
type: null
};
if (node["type"]) {
var t = node["type"].getText(); // node.symbol.valueDeclaration;
attr.type = t;
}
this.last.attributes.push(attr);
}
return;
}
var children = node.getChildren();
if (children) {
children.forEach((child) => {
this.handle(child);
});
}
// this.last = null;
}
catch (err) {
TSWorker.console.log(err.stack);
return;
}
}
isTopLevelNode(kind) {
return ((kind === ts.SyntaxKind.ClassDeclaration) ||
(kind === ts.SyntaxKind.InterfaceDeclaration) ||
(kind === ts.SyntaxKind.EnumDeclaration));
}
/**
* What type of node are we interested in
*/
interest(kind) {
switch (kind) {
case ts.SyntaxKind.ClassDeclaration:
return "class";
case ts.SyntaxKind.ModuleDeclaration:
return "container";
case ts.SyntaxKind.InterfaceDeclaration:
return "interface";
case ts.SyntaxKind.MethodDeclaration:
return "method";
case ts.SyntaxKind.EnumDeclaration:
return "enum";
case ts.SyntaxKind.PropertyDeclaration:
return "prop";
case ts.SyntaxKind.Constructor:
return "constructor";
default:
return null;
}
}
getName(node) {
return node.getText();
}
createIfNotExist(node) {
var fullName = node.name.text;
if (!this.model[fullName]) {
var entry = {
type: this.interest(node.kind),
name: fullName,
extends: [],
implements: [],
operations: [],
attributes: []
};
this.model[fullName] = entry;
if (node.heritageClauses) {
node.heritageClauses.forEach((clause) => {
entry.extends.push(clause.getText());
});
}
// var typeSymbol = node.symbol.getDeclarations();
// if (node instanceof ts.ClassDeclaration) {
/*
@TODO
if (cd.baseType) entry.extends.push(this.getName(cd.baseType));
if (cd.implementedTypes) cd.implementedTypes.forEach((implType) => {
entry.implements.push(this.getName(implType));
});
*/
// }
// if (node instanceof ts.InterfaceDeclaration) {
/*
@TODO
if (id.baseTypes) id.baseTypes.forEach((type) => {
entry.implements.push(this.getName(type));
});
*/
// }
}
return this.model[fullName];
}
}
TSWorker.ModelCreator = ModelCreator;
})(TSWorker = Cats.TSWorker || (Cats.TSWorker = {}));
})(Cats || (Cats = {}));
6 changes: 3 additions & 3 deletions resource/qooxdoo.js

Large diffs are not rendered by default.

Loading

0 comments on commit bc3fd47

Please sign in to comment.