Skip to content

Commit

Permalink
Merge pull request #23 from wasikuss/feature/php-path-in-settings
Browse files Browse the repository at this point in the history
Add option in settings to manually specify php path
  • Loading branch information
Azakur4 committed Aug 13, 2015
2 parents eb8be50 + e12ebbf commit 1db28bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 16 additions & 1 deletion lib/main.coffee
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion lib/provider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1db28bd

Please sign in to comment.