diff --git a/README.md b/README.md index 9791a949ab..aa11d36a18 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Welcome to Phoenix! -**Website: https://phcode.dev** +**Website: https://phcode.io** -Phoenix is a modern open-source and [free software](https://www.gnu.org/philosophy/free-sw.en.html) code editor for the web, built for the browser. +Phoenix is a modern open-source and [free software](https://www.gnu.org/philosophy/free-sw.en.html) text editor +designed to make coding as simple and fun as playing a video game. #### Code Guardian [![Phoenix build verification](https://github.com/phcode-dev/phoenix/actions/workflows/build_verify.yml/badge.svg)](https://github.com/phcode-dev/phoenix/actions/workflows/build_verify.yml) @@ -27,7 +28,7 @@ Phoenix is a modern open-source and [free software](https://www.gnu.org/philosop bugsnag -#### Development status: Stable/Release-candidate. +#### Development status: Stable/Active. ![Screenshot from 2022-09-20 13-35-03](https://user-images.githubusercontent.com/5336369/191202975-6069d270-526a-443d-bd76-903353ae1222.png) diff --git a/src/extensionsIntegrated/CSSColorPreview/main.js b/src/extensionsIntegrated/CSSColorPreview/main.js index ad85ab5655..1ac6a499c3 100644 --- a/src/extensionsIntegrated/CSSColorPreview/main.js +++ b/src/extensionsIntegrated/CSSColorPreview/main.js @@ -230,7 +230,6 @@ define(function (require, exports, module) { // Add listener for all editor changes EditorManager.on("activeEditorChange", function (event, newEditor, oldEditor) { if (newEditor && newEditor.isGutterActive(GUTTER_NAME)) { - console.time("xxxxxxxxxxx"); newEditor.off("cursorActivity.colorPreview"); newEditor.on("cursorActivity.colorPreview", _cursorActivity); // Unbind the previous editor's change event if it exists @@ -241,7 +240,6 @@ define(function (require, exports, module) { newEditor.on("change", onChanged); showColorMarks(); _cursorActivity(null, newEditor); - console.timeEnd("xxxxxxxxxxx"); } }); diff --git a/src/extensionsIntegrated/RecentProjects/main.js b/src/extensionsIntegrated/RecentProjects/main.js index 8822462440..0ccb33e0ef 100644 --- a/src/extensionsIntegrated/RecentProjects/main.js +++ b/src/extensionsIntegrated/RecentProjects/main.js @@ -363,7 +363,7 @@ define(function (require, exports, module) { } FileSystem.resolve(fullPath, function (err, item) { if (err) { - recentProjects.splice(index, 1); + removeFromRecentProject(fullPath); } reject(); }); diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index 7278d03137..08f5798182 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -739,6 +739,7 @@ define(function (require, exports, module) { entryType = isFolder ? Strings.DIRECTORY : Strings.FILE, title, message; + path = Phoenix.app.getDisplayPath(path); path = StringUtils.breakableUrl(path); switch (errType) { @@ -1312,7 +1313,9 @@ define(function (require, exports, module) { // which is now partially torn down (see #6574). model.projectRoot = null; - _loadProject(getWelcomeProjectPath()).always(function () { + _loadProject(getPlaceholderProjectPath()).always(function () { + // we dont load any other project here as the saved project state will not get restored + // if we load an actual project at this time. // Make sure not to reject the original deferred until the fallback // project is loaded, so we don't violate expectations that there is always // a current project before continuing after _loadProject(). @@ -1409,6 +1412,33 @@ define(function (require, exports, module) { || window.showOpenFilePicker; // fs access file picker } + function _openProject(path, result) { + // Confirm any unsaved changes first. We run the command in "prompt-only" mode, meaning it won't + // actually close any documents even on success; we'll do that manually after the user also oks + // the folder-browse dialog. + CommandManager.execute(Commands.FILE_CLOSE_ALL, { promptOnly: true }) + .done(function () { + if (path) { + // use specified path + _loadProject(path).then(result.resolve, result.reject); + } else { + // Pop up a folder browse dialog + FileSystem.showOpenDialog(false, true, Strings.CHOOSE_FOLDER, model.projectRoot.fullPath, null, + function (err, files) { + if (!err && files.length > 0) { + // Load the new project into the folder tree + _loadProject(files[0]).then(result.resolve, result.reject); + } else { + result.reject(); + } + }); + } + }) + .fail(function () { + result.reject(); + }); + } + /** * Open a new project. Currently, Brackets must always have a project open, so * this method handles both closing the current project and opening a new project. @@ -1422,7 +1452,7 @@ define(function (require, exports, module) { */ function openProject(path) { - var result = new $.Deferred(); + const result = new $.Deferred(); if(!path && !_filePickerSupported()){ Dialogs.showModalDialog( @@ -1434,29 +1464,30 @@ define(function (require, exports, module) { return result.promise(); } - // Confirm any unsaved changes first. We run the command in "prompt-only" mode, meaning it won't - // actually close any documents even on success; we'll do that manually after the user also oks - // the folder-browse dialog. - CommandManager.execute(Commands.FILE_CLOSE_ALL, { promptOnly: true }) - .done(function () { - if (path) { - // use specified path - _loadProject(path).then(result.resolve, result.reject); - } else { - // Pop up a folder browse dialog - FileSystem.showOpenDialog(false, true, Strings.CHOOSE_FOLDER, model.projectRoot.fullPath, null, function (err, files) { - if (!err && files.length > 0) { - // Load the new project into the folder tree - _loadProject(files[0]).then(result.resolve, result.reject); - } else { - result.reject(); - } - }); - } - }) - .fail(function () { - result.reject(); - }); + if(!path){ + _openProject(null, result); + return result.promise(); + } + const rootPath = ProjectModel._ensureTrailingSlash(path); + if(rootPath === getWelcomeProjectPath()) { + // welcome project path is always guaranteed to be present! + _openProject(rootPath, result); + return result.promise(); + } + + const rootEntry = FileSystem.getDirectoryForPath(path); + rootEntry.exists(function (err, exists) { + if (exists) { + _openProject(path, result); + return; + } + console.error("error project open path doesnt exist: ", path, err); + exports.trigger(EVENT_PROJECT_OPEN_FAILED, path); + _showErrorDialog(ERR_TYPE_LOADING_PROJECT_NATIVE, true, FileSystemError.NOT_FOUND, path) + .done(function () { + result.reject(); + }); + }); // if fail, don't open new project: user canceled (or we failed to save its unsaved changes) return result.promise(); diff --git a/test/spec/CSSColorPreview-test-files/base.css b/test/spec/CSSColorPreview-test-files/base.css index 20e591dbc3..b16105457f 100644 --- a/test/spec/CSSColorPreview-test-files/base.css +++ b/test/spec/CSSColorPreview-test-files/base.css @@ -16,5 +16,5 @@ .class-6 {color: #ff0090 #802095 #954e3e #454e3e #150e3e;} .class-vars { - color: var(--slight-red); background-color: @blue-light; color: var(--red); background-color: @blue; + color: var(--slight-red); background-color: @blue-light; color: var(--red); background-color: @blue; color: $white; } \ No newline at end of file