Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix checkStyleSettings when path not found #174

Closed
wants to merge 1 commit into from

Conversation

tjmehta
Copy link

@tjmehta tjmehta commented Mar 23, 2017

Open files in atom can be moved or deleted. When nonexistant files are listed, checkStyleSettings to returns undefined which causes #168. For now, I returned an empty object even when checkStyleSettings swallows any file read error.

checkStyleSettings should never return undefined
@ricardofbarros
Copy link
Owner

Hey @tjmehta, thanks for the PR I will review shortly and get back at you. Thanks

@tjmehta
Copy link
Author

tjmehta commented Apr 22, 2017

Let me know if you have any questions :)

@@ -39,7 +39,7 @@ function checkStyleSettings (filePath) {
projectPath = projectPaths.find((p) => absoluteActivePanePath.indexOf(fs.realpathSync(p)) >= 0)
} catch (e) {
console.error('Could not get project path', e)
return
return {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also write return settings like all the other return statements, because settings is an empty object anyways

@sonicdoe sonicdoe closed this in 3c9ad13 Jul 27, 2017
@sonicdoe
Copy link
Collaborator

I have fixed this in 3c9ad13.

Instead of simply returning early, I have decided to use the path returned by TextEditor::getPath(). This allows us to honor the style settings specified in package.json even if the file does not exist in the file system (anymore).

Nevertheless, thank you, @tjmehta and @jscissr, for pointing us to the source of the error 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants