From e12ebbf6cb11f78637084bf4094a6a72a6b86426 Mon Sep 17 00:00:00 2001 From: wasikuss Date: Wed, 12 Aug 2015 20:50:40 +0200 Subject: [PATCH] Add option in settings to manually specify php path --- lib/main.coffee | 17 ++++++++++++++++- lib/provider.coffee | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/main.coffee b/lib/main.coffee index 2696398..229f4d8 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -1,6 +1,21 @@ +{CompositeDisposable} = require 'atom' provider = require './provider' module.exports = - activate: -> provider.loadCompletions() + config: + executablePath: + type: 'string' + title: 'PHP Executable Path' + default: 'php' # Let OS's $PATH handle the rest + + activate: -> + @subscriptions = new CompositeDisposable + @subscriptions.add atom.config.observe 'autocomplete-php.executablePath', + (executablePath) -> + provider.executablePath = executablePath + provider.loadCompletions() + + deactivate: -> + @subscriptions.dispose() getProvider: -> provider diff --git a/lib/provider.coffee b/lib/provider.coffee index 091d25b..b539e62 100644 --- a/lib/provider.coffee +++ b/lib/provider.coffee @@ -3,6 +3,8 @@ fs = require 'fs' path = require 'path' module.exports = + executablePath: 'php' + # This will work on JavaScript and CoffeeScript files, but not in js comments. selector: '.source.php' disableForSelector: '.source.php .comment' @@ -33,7 +35,7 @@ module.exports = @compileData = '' phpEx = 'get_user_all.php' - proc = exec.spawn 'php', [__dirname + '/php/' + phpEx] + proc = exec.spawn this.executablePath, [__dirname + '/php/' + phpEx] proc.stdin.write(editor.getText()) proc.stdin.end()