Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 05b3247

Browse files
authored
Merge pull request #13960 from adobe/navc/RestructuringJSCodeHints
Navc/restructuring js code hints
2 parents 18dd431 + 2422097 commit 05b3247

File tree

17 files changed

+61
-43
lines changed

17 files changed

+61
-43
lines changed

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module.exports = function (grunt) {
8181
cwd: 'src/',
8282
src: [
8383
'extensibility/node/**',
84+
'JSUtils/node/**',
8485
'!extensibility/node/spec/**',
8586
'!extensibility/node/node_modules/**/{test,tst}/**/*',
8687
'!extensibility/node/node_modules/**/examples/**/*',
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
define(function (require, exports, module) {
6666
"use strict";
6767

68-
var StringUtils = brackets.getModule("utils/StringUtils");
68+
var StringUtils = require("utils/StringUtils");
6969

7070
/**
7171
* Convert an array of strings with optional wildcards, to an equivalent
Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@
3131
define(function (require, exports, module) {
3232
"use strict";
3333

34-
var _ = brackets.getModule("thirdparty/lodash");
35-
36-
var CodeMirror = brackets.getModule("thirdparty/CodeMirror/lib/codemirror"),
37-
DefaultDialogs = brackets.getModule("widgets/DefaultDialogs"),
38-
Dialogs = brackets.getModule("widgets/Dialogs"),
39-
DocumentManager = brackets.getModule("document/DocumentManager"),
40-
EditorManager = brackets.getModule("editor/EditorManager"),
41-
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
42-
FileSystem = brackets.getModule("filesystem/FileSystem"),
43-
FileUtils = brackets.getModule("file/FileUtils"),
44-
LanguageManager = brackets.getModule("language/LanguageManager"),
45-
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
46-
ProjectManager = brackets.getModule("project/ProjectManager"),
47-
Strings = brackets.getModule("strings"),
48-
StringUtils = brackets.getModule("utils/StringUtils"),
49-
NodeDomain = brackets.getModule("utils/NodeDomain"),
50-
InMemoryFile = brackets.getModule("document/InMemoryFile");
51-
52-
var HintUtils = require("HintUtils"),
53-
MessageIds = require("MessageIds"),
54-
Preferences = require("Preferences");
34+
var _ = require("thirdparty/lodash");
35+
36+
var CodeMirror = require("thirdparty/CodeMirror/lib/codemirror"),
37+
DefaultDialogs = require("widgets/DefaultDialogs"),
38+
Dialogs = require("widgets/Dialogs"),
39+
DocumentManager = require("document/DocumentManager"),
40+
EditorManager = require("editor/EditorManager"),
41+
ExtensionUtils = require("utils/ExtensionUtils"),
42+
FileSystem = require("filesystem/FileSystem"),
43+
FileUtils = require("file/FileUtils"),
44+
LanguageManager = require("language/LanguageManager"),
45+
PreferencesManager = require("preferences/PreferencesManager"),
46+
ProjectManager = require("project/ProjectManager"),
47+
Strings = require("strings"),
48+
StringUtils = require("utils/StringUtils"),
49+
NodeDomain = require("utils/NodeDomain"),
50+
InMemoryFile = require("document/InMemoryFile");
51+
52+
var HintUtils = require("./HintUtils"),
53+
MessageIds = require("./MessageIds"),
54+
Preferences = require("./Preferences");
5555

5656
var ternEnvironment = [],
5757
pendingTernRequests = {},
@@ -64,9 +64,11 @@ define(function (require, exports, module) {
6464
preferences = null,
6565
deferredPreferences = null;
6666

67-
var _modulePath = FileUtils.getNativeModuleDirectoryPath(module),
68-
_nodePath = "node/TernNodeDomain",
69-
_domainPath = [_modulePath, _nodePath].join("/");
67+
var _bracketsPath = FileUtils.getNativeBracketsDirectoryPath(),
68+
_modulePath = FileUtils.getNativeModuleDirectoryPath(module),
69+
_nodePath = "node/TernNodeDomain",
70+
_absoluteModulePath = [_bracketsPath, _modulePath].join("/"),
71+
_domainPath = [_bracketsPath, _modulePath, _nodePath].join("/");
7072

7173

7274
var MAX_HINTS = 30, // how often to reset the tern server
@@ -89,7 +91,7 @@ define(function (require, exports, module) {
8991
* Read in the json files that have type information for the builtins, dom,etc
9092
*/
9193
function initTernEnv() {
92-
var path = ExtensionUtils.getModulePath(module, "node/node_modules/tern/defs/"),
94+
var path = [_absoluteModulePath, "node/node_modules/tern/defs/"].join("/"),
9395
files = builtinFiles,
9496
library;
9597

src/extensions/default/JavaScriptCodeHints/Session.js renamed to src/JSUtils/Session.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
define(function (require, exports, module) {
2727
"use strict";
2828

29-
var StringMatch = brackets.getModule("utils/StringMatch"),
30-
TokenUtils = brackets.getModule("utils/TokenUtils"),
31-
LanguageManager = brackets.getModule("language/LanguageManager"),
32-
HTMLUtils = brackets.getModule("language/HTMLUtils"),
33-
HintUtils = require("HintUtils"),
34-
ScopeManager = require("ScopeManager"),
29+
var StringMatch = require("utils/StringMatch"),
30+
TokenUtils = require("utils/TokenUtils"),
31+
LanguageManager = require("language/LanguageManager"),
32+
HTMLUtils = require("language/HTMLUtils"),
33+
HintUtils = require("JSUtils/HintUtils"),
34+
ScopeManager = require("JSUtils/ScopeManager"),
3535
Acorn = require("node_modules/acorn/dist/acorn"),
3636
Acorn_Loose = require("node_modules/acorn/dist/acorn_loose");
3737

src/JSUtils/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "brackets-javascript-code-utils",
3+
"dependencies": {
4+
"acorn": "3.3.0"
5+
}
6+
}

0 commit comments

Comments
 (0)