|
Lines 21-27
Link Here
|
| 21 |
|| fileName === project.ESLINTRC_JS |
21 |
|| fileName === project.ESLINTRC_JS |
| 22 |
|| fileName === project.ESLINTRC_JSON |
22 |
|| fileName === project.ESLINTRC_JSON |
| 23 |
|| fileName === project.PACKAGE_JSON |
23 |
|| fileName === project.PACKAGE_JSON |
| 24 |
|| fileName === project.ESLINTRC_YAML |
24 |
|| fileName === project.ESLINTRC_YAML |
| 25 |
|| fileName === project.ESLINTRC_YML) { |
25 |
|| fileName === project.ESLINTRC_YML) { |
| 26 |
delete project.map.eslint; |
26 |
delete project.map.eslint; |
| 27 |
} |
27 |
} |
|
Lines 145-151
Link Here
|
| 145 |
*/ |
145 |
*/ |
| 146 |
JavaScriptProject.prototype.getProjectPath = function getProjectPath() { |
146 |
JavaScriptProject.prototype.getProjectPath = function getProjectPath() { |
| 147 |
if(this.projectMeta) { |
147 |
if(this.projectMeta) { |
| 148 |
return this.projectMeta.Location; |
148 |
return this.projectMeta.Location || "/file/"; |
| 149 |
} |
149 |
} |
| 150 |
return null; |
150 |
return null; |
| 151 |
}; |
151 |
}; |
|
Lines 174-180
Link Here
|
| 174 |
return this.ecma; |
174 |
return this.ecma; |
| 175 |
}.bind(this)); |
175 |
}.bind(this)); |
| 176 |
}; |
176 |
}; |
| 177 |
|
177 |
|
| 178 |
/** |
178 |
/** |
| 179 |
* @description Fetch the named child of the current project context |
179 |
* @description Fetch the named child of the current project context |
| 180 |
* @function |
180 |
* @function |
|
Lines 185-196
Link Here
|
| 185 |
if(!this.projectMeta) { |
185 |
if(!this.projectMeta) { |
| 186 |
return new Deferred().resolve(null); |
186 |
return new Deferred().resolve(null); |
| 187 |
} |
187 |
} |
| 188 |
var filePath = this.projectMeta.Location+childName; |
188 |
|
|
|
189 |
var filePath = this.getProjectPath()+childName; |
| 189 |
if(this.map[filePath]) { |
190 |
if(this.map[filePath]) { |
| 190 |
return new Deferred().resolve(this.map[filePath]); |
191 |
return new Deferred().resolve(this.map[filePath]); |
| 191 |
} |
192 |
} |
| 192 |
return this.getFileClient().read(filePath, false, false, {readIfExists: true}).then(function(child) { |
193 |
return this.getFileClient().read(filePath, false, false, {readIfExists: true}).then(function(child) { |
| 193 |
this.map[filePath] = {name: filePath, contents: child, project: this.projectMeta.Location}; |
194 |
this.map[filePath] = {name: filePath, contents: child, project: this.getProjectPath()}; |
| 194 |
return this.map[filePath]; |
195 |
return this.map[filePath]; |
| 195 |
}.bind(this), |
196 |
}.bind(this), |
| 196 |
function() { |
197 |
function() { |
|
Lines 232-240
Link Here
|
| 232 |
} else { |
233 |
} else { |
| 233 |
json = values; |
234 |
json = values; |
| 234 |
} |
235 |
} |
| 235 |
return this.getFileClient().write(this.projectMeta.Location+childName, JSON.stringify(json, null, '\t')); |
236 |
return this.getFileClient().write(this.getProjectPath()+childName, JSON.stringify(json, null, '\t')); |
| 236 |
} else if(create) { |
237 |
} else if(create) { |
| 237 |
return this.getFileClient().createFile(this.projectMeta.Location, childName).then(function(file) { |
238 |
return this.getFileClient().createFile(this.getProjectPath(), childName).then(function(file) { |
| 238 |
json = _defaultsFor(childName); |
239 |
json = _defaultsFor(childName); |
| 239 |
if(json) { |
240 |
if(json) { |
| 240 |
_merge(json, values); |
241 |
_merge(json, values); |
|
Lines 247-259
Link Here
|
| 247 |
} |
248 |
} |
| 248 |
}; |
249 |
}; |
| 249 |
|
250 |
|
| 250 |
/** |
251 |
/** |
| 251 |
* @description Get the defaults used when creating a new tracked file |
252 |
* @description Get the defaults used when creating a new tracked file |
| 252 |
* @private |
253 |
* @private |
| 253 |
* @param {String} filename The name of tracked file to create |
254 |
* @param {String} filename The name of tracked file to create |
| 254 |
* @returns {{}|null} An object of default values or null |
255 |
* @returns {{}|null} An object of default values or null |
| 255 |
* @since 13.0 |
256 |
* @since 13.0 |
| 256 |
*/ |
257 |
*/ |
| 257 |
function _defaultsFor(filename) { |
258 |
function _defaultsFor(filename) { |
| 258 |
switch(filename) { |
259 |
switch(filename) { |
| 259 |
case JavaScriptProject.prototype.TERN_PROJECT: { |
260 |
case JavaScriptProject.prototype.TERN_PROJECT: { |
|
Lines 412-425
Link Here
|
| 412 |
} |
413 |
} |
| 413 |
} |
414 |
} |
| 414 |
if (project) { |
415 |
if (project) { |
| 415 |
if(!this.projectMeta || project.Location !== this.projectMeta.Location) { |
416 |
if(!this.projectMeta || (project.Location !== this.projectMeta.Location && typeof this.projectMeta.Location === "string")) { |
| 416 |
this.projectMeta = project; |
417 |
this.projectMeta = project; |
| 417 |
delete this.ecma; |
418 |
delete this.ecma; |
| 418 |
delete this.map[this.TERN_PROJECT]; |
419 |
delete this.map[this.TERN_PROJECT]; |
| 419 |
_handle.call(this, "onProjectChanged", this, evnt, project.Location); |
420 |
_handle.call(this, "onProjectChanged", this, evnt, project.Location || "/file/"); |
| 420 |
return; |
421 |
return; |
| 421 |
} |
422 |
} |
| 422 |
_handle.call(this, "onInputChanged", this, evnt, project.Location); |
423 |
_handle.call(this, "onInputChanged", this, evnt, project.Location || "/file/"); |
| 423 |
} else { |
424 |
} else { |
| 424 |
delete this.ecma; |
425 |
delete this.ecma; |
| 425 |
_handle.call(this, "onProjectChanged", this, evnt, null); |
426 |
_handle.call(this, "onProjectChanged", this, evnt, null); |