-
Notifications
You must be signed in to change notification settings - Fork 185
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
Include local and global installation instructions in README.md. #639
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #639 +/- ##
=========================================
Coverage 81.52% 81.52%
Complexity 912 912
=========================================
Files 62 62
Lines 2078 2078
=========================================
Hits 1694 1694
Misses 384 384 |
README.md
Outdated
``` | ||
{ | ||
"minimum-stability": "dev", | ||
"prefer-stable": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend adding these lines:
so then it's not needed to run manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I changed it. I am unsure at the moment if I need the following line.
After editing your composer.json, you can install felixfbecker/php-language-server.
composer global require felixfbecker/language-server
I can check if the line above is needed but it will have to be tomorrow. I'm about to turn off the computer for the day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the lines in question above they are needed.
Side question, what is the use case for installing globally? |
I haven't done it myself. I included it because it was in emacs-lsp/lsp-php readme. I'll ask the creator of the README and see why he included it. |
Would appreciate this getting merged too as current instructions in the readme did not work for me and I wasn't sure why as I don't know composer. I got this error with default instructions:
|
Well, to be fair these instructions didn't help either. Still getting same error. But personally I think installing globally makes sense as this is the kind of package that IMO should be installed globally in user's directory rather than in specific project as it is generally consumed by text editors. |
I have found #611 and managed to fix my issue. Problem for me was that I already had EDIT: But then after deleting |
The recommended installation method is through [Composer](https://getcomposer.org/). Follow the following installation instructions for local or global installation after installing composer on your system. | ||
|
||
### Local Installation | ||
Create a directory for php-language-server. Create a composer.json file in it, with the following contents: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea for local installation is that your add this to the composer.json file of your project, where the project is something like https://github.com/felixfbecker/vscode-php-intellisense or some other editor integration or use case for the language server. The directory shouldn't be considered "the directory for php-language-server" because that will be ./vendor/felixfbecker/language-server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the idea here is that some users will want to try this out without making any changes to their global composer config, and these instructions provide a way of creating a local (perhaps temporary) instance of the language server without touching anything else.
The text editor can then be pointed to the local installation for testing. If it all pans out, the user might move to a global install (or not, as the case may be).
So "local" installation here can be thought of as a self-contained installation, rather than integrating it into another project like vscode-php-intellisense. Perhaps that should be covered as a third case, though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of why users might want a separate/self-contained installation is so that they can patch the language server for specific use-cases without affecting their global installation. For instance, modifying the hard-coded set of filename extensions which should be treated as PHP files in a particular project type -- a need that I personally ran into yesterday.
``` | ||
|
||
### Global installation | ||
Before installing php-language-server, make sure your ~/.config/composer/composer.json includes the lines below. The settings apply to all globally installed Composer packages, so proceed with caution. If you do not want to edit your global Composer configuration, see the section for local installation above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least on my system (Mac with homebrew installed php and composer), the global config is in ~/.composer/composer.json
rather than ~/.config/composer/composer.json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More generally, use $COMPOSER_HOME
if it's set. Refer to https://getcomposer.org/doc/03-cli.md#composer-home
If it's not set, note that a hard-coded fallback could be error-prone, as the default value is quite variable depending on the OS (and version thereof) you're running.
This pull request alters the installation section of the readme to include the installation instructions found at emacs-lsp/lsp-php
I found that guide helpful. Hopefully it helps others.