Skip to content

Commit

Permalink
Updated to use new Brackets filesystem API
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Wehrman committed Nov 9, 2013
1 parent 5e30462 commit 9b28d9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
21 changes: 12 additions & 9 deletions ScopeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define(function (require, exports, module) {
var DocumentManager = brackets.getModule("document/DocumentManager"),
LanguageManager = brackets.getModule("language/LanguageManager"),
FileUtils = brackets.getModule("file/FileUtils"),
NativeFileSystem = brackets.getModule("file/NativeFileSystem").NativeFileSystem,
FileSystem = brackets.getModule("filesystem/FileSystem"),
ProjectManager = brackets.getModule("project/ProjectManager"),
HintUtils = require("HintUtils"),
Scope = require("Scope");
Expand Down Expand Up @@ -141,8 +141,7 @@ define(function (require, exports, module) {
// we might need to update the outer scope
if (state.scope === null || state.dirtyFile) {
if (!state.active) {
var path = dir + file,
entry = new NativeFileSystem.FileEntry(path);
var path = dir + file;

// the outer scope worker is about to be active
state.active = true;
Expand Down Expand Up @@ -427,20 +426,26 @@ define(function (require, exports, module) {
dir = split.dir,
file = split.file;

NativeFileSystem.resolveNativeFileSystemPath(dir, function (dirEntry) {
var reader = dirEntry.createReader();
FileSystem.resolve(dir, function (err, dirEntry) {
if (err) {
return;
}

markFileDirty(dir, file);

reader.readEntries(function (entries) {
dirEntry.getContents(function (err, entries) {
if (err) {
return;
}

entries.slice(0, MAX_FILES_IN_DIR).forEach(function (entry) {
if (entry.isFile) {
var path = entry.fullPath,
split = HintUtils.splitPath(path),
dir = split.dir,
file = split.file;

if (file.indexOf(".") > 1) { // ignore /.dotfiles
if (file.indexOf(".") !== 0) { // ignore /.dotfiles
var languageID = LanguageManager.getLanguageForPath(entry.fullPath).getId();
if (languageID === HintUtils.LANGUAGE_ID) {
DocumentManager.getDocumentForPath(path).done(function (document) {
Expand All @@ -454,8 +459,6 @@ define(function (require, exports, module) {
console.log("Unable to refresh directory: " + err);
refreshOuterScope(dir, file, document.getText());
});
}, function (err) {
console.log("Directory \"%s\" does not exist", dir);
});
}

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "brackets-simple-js-code-hints",
"title": "Simple JS Code Hints",
"author" : "Ian Wehrman <ian@wehrman.org>",
"description": "Brackets extension to that provides simple code hints. No type inference here, friends!",
"version": "1.0.0",
"description": "Brackets extension to that provides simple code hints for JavaScript. No type inference here, friends!",
"version": "1.0.1",
"keywords": [".js"],
"homepage": "https://github.com/iwehrman/brackets-simple-js-code-hints",
"bugs": "https://github.com/iwehrman/brackets-simple-js-code-hints/issues",
"repository" : {
"type" : "git",
"url": "https://github.com/iwehrman/brackets-simple-js-code-hints.git"
},
"engines": {
"brackets": ">=0.34.0"
}
}

0 comments on commit 9b28d9e

Please sign in to comment.