mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Update JS code hints (including unit tests) to work with new language and
Editor APIs.
This commit is contained in:
1 parent
bebb6cf937
commit
5a026ec9ff
2 files changed
+8
-10
No files matched your search
@@ -35,7 +35,7 @@ define(function (require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var DocumentManager = brackets.getModule("document/DocumentManager"),
|
||||
EditorUtils = brackets.getModule("editor/EditorUtils"),
|
||||
LanguageManager = brackets.getModule("language/LanguageManager"),
|
||||
FileUtils = brackets.getModule("file/FileUtils"),
|
||||
NativeFileSystem = brackets.getModule("file/NativeFileSystem").NativeFileSystem,
|
||||
ProjectManager = brackets.getModule("project/ProjectManager"),
|
||||
@@ -440,7 +440,7 @@ define(function (require, exports, module) {
|
||||
file = split.file;
|
||||
|
||||
if (file.indexOf(".") > 1) { // ignore /.dotfiles
|
||||
var mode = EditorUtils.getModeFromFileExtension(entry.fullPath);
|
||||
var mode = LanguageManager.getLanguageForFileExtension(entry.fullPath).mode;
|
||||
if (mode === HintUtils.MODE_NAME) {
|
||||
DocumentManager.getDocumentForPath(path).done(function (document) {
|
||||
refreshOuterScope(dir, file, document.getText());
|
||||
|
||||
@@ -41,16 +41,14 @@ define(function (require, exports, module) {
|
||||
testEditor;
|
||||
|
||||
/**
|
||||
* Returns an Editor suitable for use in isolation: i.e., a Document that
|
||||
* will never be set as the currentDocument or added to the working set.
|
||||
* Returns an Editor suitable for use in isolation, given a Document. (Unlike
|
||||
* SpecRunnerUtils.createMockEditor(), which is given text and creates the Document
|
||||
* for you).
|
||||
*
|
||||
* @param {Document} doc - the document to be contained by the new Editor
|
||||
* @param {string} mode - the CodeMirror mode of the new Editor
|
||||
* @return {Editor} - the mock editor object
|
||||
*/
|
||||
function createMockEditor(doc, mode) {
|
||||
mode = mode || "";
|
||||
|
||||
function createMockEditor(doc) {
|
||||
// Initialize EditorManager
|
||||
var $editorHolder = $("<div id='mock-editor-holder'/>");
|
||||
EditorManager.setEditorHolder($editorHolder);
|
||||
@@ -58,7 +56,7 @@ define(function (require, exports, module) {
|
||||
$("body").append($editorHolder);
|
||||
|
||||
// create Editor instance
|
||||
var editor = new Editor(doc, true, mode, $editorHolder.get(0));
|
||||
var editor = new Editor(doc, true, $editorHolder.get(0));
|
||||
|
||||
return editor;
|
||||
}
|
||||
@@ -263,7 +261,7 @@ define(function (require, exports, module) {
|
||||
|
||||
// create Editor instance (containing a CodeMirror instance)
|
||||
runs(function () {
|
||||
testEditor = createMockEditor(testDoc, "javascript");
|
||||
testEditor = createMockEditor(testDoc);
|
||||
JSCodeHints.initializeSession(testEditor);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user