Code snippets used in blog post "Contributing to Open Source Projects - atom-scalariform": https://pbassiner.github.io/blog/contributing_to_open_source_projects_-_atom-scalariform.html
Last active
December 22, 2016 07:46
-
-
Save pbassiner/c8afc3af6f591702bf173354fa7859ad to your computer and use it in GitHub Desktop.
Blog Post - Contributing to Open Source Projects - atom-scalariform: Ammonite support + scalariform properties relative to project code snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projectPath = function(fileToFormatPath) { | |
var ref = atom.project.getDirectories(); | |
var projectPath = ''; | |
for (var i = 0, len = ref.length; i < len; i++) { | |
var directory = ref[i]; | |
if (fileToFormatPath.indexOf(directory.path) > -1) { | |
projectPath = directory.path; | |
} | |
} | |
return projectPath; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (activeTextEditor === '' || | |
!(activeTextEditor.getPath().endsWith(".scala") || activeTextEditor.getPath().endsWith(".sc"))) { | |
atom.notifications.addError("You do not have a valid scala file open!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (activeTextEditor === '' || !activeTextEditor.getPath().endsWith(".scala")) { | |
atom.notifications.addError("You do not have a valid scala file open!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment