1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 18:02:54 +01:00

Merge pull request #13960 from adobe/navc/RestructuringJSCodeHints

Navc/restructuring js code hints
This commit is contained in:
Prashanth Nethi 2017-12-13 14:45:19 +05:30 committed by GitHub
commit 05b3247912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 59 additions and 41 deletions

View File

@ -81,6 +81,7 @@ module.exports = function (grunt) {
cwd: 'src/',
src: [
'extensibility/node/**',
'JSUtils/node/**',
'!extensibility/node/spec/**',
'!extensibility/node/node_modules/**/{test,tst}/**/*',
'!extensibility/node/node_modules/**/examples/**/*',

View File

@ -65,7 +65,7 @@
define(function (require, exports, module) {
"use strict";
var StringUtils = brackets.getModule("utils/StringUtils");
var StringUtils = require("utils/StringUtils");
/**
* Convert an array of strings with optional wildcards, to an equivalent

View File

@ -31,27 +31,27 @@
define(function (require, exports, module) {
"use strict";
var _ = brackets.getModule("thirdparty/lodash");
var _ = require("thirdparty/lodash");
var CodeMirror = brackets.getModule("thirdparty/CodeMirror/lib/codemirror"),
DefaultDialogs = brackets.getModule("widgets/DefaultDialogs"),
Dialogs = brackets.getModule("widgets/Dialogs"),
DocumentManager = brackets.getModule("document/DocumentManager"),
EditorManager = brackets.getModule("editor/EditorManager"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
FileSystem = brackets.getModule("filesystem/FileSystem"),
FileUtils = brackets.getModule("file/FileUtils"),
LanguageManager = brackets.getModule("language/LanguageManager"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
ProjectManager = brackets.getModule("project/ProjectManager"),
Strings = brackets.getModule("strings"),
StringUtils = brackets.getModule("utils/StringUtils"),
NodeDomain = brackets.getModule("utils/NodeDomain"),
InMemoryFile = brackets.getModule("document/InMemoryFile");
var CodeMirror = require("thirdparty/CodeMirror/lib/codemirror"),
DefaultDialogs = require("widgets/DefaultDialogs"),
Dialogs = require("widgets/Dialogs"),
DocumentManager = require("document/DocumentManager"),
EditorManager = require("editor/EditorManager"),
ExtensionUtils = require("utils/ExtensionUtils"),
FileSystem = require("filesystem/FileSystem"),
FileUtils = require("file/FileUtils"),
LanguageManager = require("language/LanguageManager"),
PreferencesManager = require("preferences/PreferencesManager"),
ProjectManager = require("project/ProjectManager"),
Strings = require("strings"),
StringUtils = require("utils/StringUtils"),
NodeDomain = require("utils/NodeDomain"),
InMemoryFile = require("document/InMemoryFile");
var HintUtils = require("HintUtils"),
MessageIds = require("MessageIds"),
Preferences = require("Preferences");
var HintUtils = require("./HintUtils"),
MessageIds = require("./MessageIds"),
Preferences = require("./Preferences");
var ternEnvironment = [],
pendingTernRequests = {},
@ -64,9 +64,11 @@ define(function (require, exports, module) {
preferences = null,
deferredPreferences = null;
var _modulePath = FileUtils.getNativeModuleDirectoryPath(module),
_nodePath = "node/TernNodeDomain",
_domainPath = [_modulePath, _nodePath].join("/");
var _bracketsPath = FileUtils.getNativeBracketsDirectoryPath(),
_modulePath = FileUtils.getNativeModuleDirectoryPath(module),
_nodePath = "node/TernNodeDomain",
_absoluteModulePath = [_bracketsPath, _modulePath].join("/"),
_domainPath = [_bracketsPath, _modulePath, _nodePath].join("/");
var MAX_HINTS = 30, // how often to reset the tern server
@ -89,7 +91,7 @@ define(function (require, exports, module) {
* Read in the json files that have type information for the builtins, dom,etc
*/
function initTernEnv() {
var path = ExtensionUtils.getModulePath(module, "node/node_modules/tern/defs/"),
var path = [_absoluteModulePath, "node/node_modules/tern/defs/"].join("/"),
files = builtinFiles,
library;

View File

@ -26,12 +26,12 @@
define(function (require, exports, module) {
"use strict";
var StringMatch = brackets.getModule("utils/StringMatch"),
TokenUtils = brackets.getModule("utils/TokenUtils"),
LanguageManager = brackets.getModule("language/LanguageManager"),
HTMLUtils = brackets.getModule("language/HTMLUtils"),
HintUtils = require("HintUtils"),
ScopeManager = require("ScopeManager"),
var StringMatch = require("utils/StringMatch"),
TokenUtils = require("utils/TokenUtils"),
LanguageManager = require("language/LanguageManager"),
HTMLUtils = require("language/HTMLUtils"),
HintUtils = require("JSUtils/HintUtils"),
ScopeManager = require("JSUtils/ScopeManager"),
Acorn = require("node_modules/acorn/dist/acorn"),
Acorn_Loose = require("node_modules/acorn/dist/acorn_loose");

6
src/JSUtils/package.json Normal file
View File

@ -0,0 +1,6 @@
{
"name": "brackets-javascript-code-utils",
"dependencies": {
"acorn": "3.3.0"
}
}

View File

@ -150,6 +150,10 @@ define(function (require, exports, module) {
require("search/FindInFilesUI");
require("search/FindReplace");
//Load common JS module
require("JSUtils/Session");
require("JSUtils/ScopeManager");
PerfUtils.addMeasurement("brackets module dependencies resolved");
// Local variables

View File

@ -249,7 +249,6 @@ define(function (require, exports, module) {
codeHintsEnabled = true,
codeHintOpened = false;
PreferencesManager.definePreference("showCodeHints", "boolean", true, {
description: Strings.DESCRIPTION_SHOW_CODE_HINTS
});

View File

@ -32,7 +32,7 @@ define(function (require, exports, module) {
Menus = brackets.getModule("command/Menus"),
Strings = brackets.getModule("strings"),
HintsUtils2 = require("HintUtils2"),
ScopeManager = require("ScopeManager");
ScopeManager = brackets.getModule("JSUtils/ScopeManager");
/** @const {string} Show Function Hint command ID */

View File

@ -38,9 +38,9 @@ define(function (require, exports, module) {
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
Strings = brackets.getModule("strings"),
ParameterHintManager = require("ParameterHintManager"),
HintUtils = require("HintUtils"),
ScopeManager = require("ScopeManager"),
Session = require("Session"),
HintUtils = brackets.getModule("JSUtils/HintUtils"),
ScopeManager = brackets.getModule("JSUtils/ScopeManager"),
Session = brackets.getModule("JSUtils/Session"),
Acorn = require("node_modules/acorn/dist/acorn");
var session = null, // object that encapsulates the current session state

View File

@ -37,9 +37,9 @@ define(function (require, exports, module) {
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
SpecRunnerUtils = brackets.getModule("spec/SpecRunnerUtils"),
JSCodeHints = require("main"),
Preferences = require("Preferences"),
ScopeManager = require("ScopeManager"),
HintUtils = require("HintUtils"),
Preferences = brackets.getModule("JSUtils/Preferences"),
ScopeManager = brackets.getModule("JSUtils/ScopeManager"),
HintUtils = brackets.getModule("JSUtils/HintUtils"),
HintUtils2 = require("HintUtils2"),
ParameterHintManager = require("ParameterHintManager");

View File

@ -70,9 +70,13 @@ module.exports = function (grunt) {
});
grunt.registerTask("npm-install-src", "Install node_modules to the src folder", function () {
var done = this.async();
runNpmInstall("src", function (err) {
return err ? done(false) : done();
var _done = this.async(),
dirs = ["src", "src/JSUtils", "src/JSUtils/node"],
done = _.after(dirs.length, _done);
dirs.forEach(function (dir) {
runNpmInstall(dir, function (err) {
return err ? _done(false) : done();
});
});
});

View File

@ -73,6 +73,8 @@ define(function (require, exports, module) {
require("utils/NodeDomain");
require("utils/ColorUtils");
require("preferences/PreferencesBase");
require("JSUtils/Session");
require("JSUtils/ScopeManager");
// Load modules that self-register and just need to get included in the test-runner window
require("document/ChangedDocumentTracker");