Skip to content

Commit 5ad58fc

Browse files
author
tomsdev
committed
More documentation
1 parent 12159aa commit 5ad58fc

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

PathUtils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ define(function (require, exports, module) {
3636
* @returns {string}
3737
*/
3838
function convertRelativePathToFullPath(relativePath, directoryPath) {
39-
//TODO: handle parent relative path (starting with ../)
4039
var fullPath = directoryPath + "/" + relativePath;
41-
console.log("FullPath calculated: ", fullPath);
4240
return fullPath;
4341
}
4442

TypeScript/TypeScriptDocument.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ define(function (require, exports, module) {
183183
*/
184184
TypeScriptDocument.prototype.getFullPath = function (relativePath) {
185185
var parentPath = PathUtils.getParentPath(this.doc.file.fullPath);
186-
// WARNING: won't work with parent relative path for the moment
187186
return PathUtils.convertRelativePathToFullPath(relativePath, parentPath);
188187
};
189188

TypeScript/TypeScriptService.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
2626
/*global define, brackets, $ */
2727

28+
/**
29+
* TypeScriptService provides methods to create or get from cache TypeScriptSession
30+
* objects. It maintains a cache of this sessions. It listens to the activeEditorChange
31+
* event and changes the current session with a new one bound to the new active document.
32+
*/
2833
define(function (require, exports, module) {
2934
"use strict";
3035

TypeScript/TypeScriptSession.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ define(function (require, exports, module) {
106106
//TODO: do it only when the change is at the top of the file (before the first line of code)
107107
var references = this.tsDoc.getReferences(),
108108
that = this;
109-
110109
// Attach added references
111110
if (references.added.length > 0) {
112111
this._attachReferencedDocuments(references.added);
113112
}
114-
115113
// Detach removed references
116114
references.removed.forEach(function (relativePath) {
117115
var fullPath = that.tsDoc.getFullPath(relativePath);
@@ -120,7 +118,6 @@ define(function (require, exports, module) {
120118
that._detachDocument(doc);
121119
}
122120
});
123-
124121
this.tsDoc.updateScriptWithChanges(doc, changes);
125122
this.tsDoc.triggerHandlerChange();
126123
};
@@ -139,11 +136,12 @@ define(function (require, exports, module) {
139136
console.error("Document for this path already in _attachedDocuments: ", doc.file.fullPath);
140137
return;
141138
}
142-
139+
// Listen to change event
143140
doc.addRef();
144141
$(doc).on(TypeScriptUtils.eventName("change"), handleChangeFn);
145-
this._attachedDocuments[doc.file.fullPath] = doc;
146142

143+
this._attachedDocuments[doc.file.fullPath] = doc;
144+
// Add the script content
147145
this.tsDoc.updateScriptWithText(doc);
148146
console.log("Script attached: ", doc.file.fullPath);
149147
};
@@ -180,7 +178,7 @@ define(function (require, exports, module) {
180178
DocumentManager.getDocumentForPath(fullPath)
181179
.done(function (referencedDoc) {
182180
that._attachDocument(referencedDoc,
183-
that._handleReferencedDocumentChange.bind(that));
181+
that._handleReferencedDocumentChange.bind(that));
184182
result.resolve();
185183
})
186184
.fail(function () {

TypeScriptCodeHints/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ define(function (require, exports, module) {
307307
}
308308

309309
TypeScriptService.getSession(this.editor.document).done(function (session) {
310-
// if the user typed something that changed the current document
310+
// If the user typed something that changed the current document
311311
if (implicitChar) {
312-
// wait for the current typescript document "change" event because typescript
312+
// Wait for the current typescript document "change" event because typescript
313313
// has to process the file with the changes before getting the completions
314314
$(session.tsDoc).on(eventName("change"), function () {
315315
$(session.tsDoc).off(eventName("change"));

0 commit comments

Comments
 (0)