Development¶
Setting up development environment¶
A demo of the setup can be found on youtube.
It is recommended to work on the forked copy of this repository from your github account to raise pull requests.
git clone git@github.com:<your-github-id>/ansible-language-server.git
cd ansible-language-server
git remote add upstream git@github.com:ansible/ansible-language-server.git
git fetch --all
git checkout -b <name_of_branch> upstream/main
Running & debugging the language-server with VS Code¶
- Install dependent packages within ansible-language-server root directory
This will install the dependent modules under node_modules
folder within the
current directory.
- Clone the repository containing the VS Code extension code into the
vscode-ansible
directory next to the root directory of this repository.
-
Open a new VS Code window and add folder to workspace
File -> Add folder to workspace
and addvscode-ansible
andansible-language-server
folders to the workspace -
Once the language server and
vscode-ansible/
directory is prepared, compile both client and server using command
-
In the Run and debug window select Client + Server (source) configuration and start debugging
Run -> Start Debugging
. This will open up a new VS Code window which is theExtension development Host
window. -
In the
Extension development Host
window add a new folder that has ansible files. -
You can set the ansible-language-server settings by adding
.vscode/settings.json
file under the root folder. Example settings:
{
"ansible.python.interpreterPath": "<change to python3 executable path>",
"ansible.ansible.path": "<change to ansible executable path>",
"ansibleServer.trace.server": "verbose"
}
Cleaning the output¶
If you hit an odd compilation or debugger problem, don't hesitate to clean the
output directory by running npm run clean
under the vscode-ansible
folder.
You should also run it whenever you are switching between debug/compilation
modes.
Building server locally¶
-
Install prerequisites:
-
latest Visual Studio Code
-
Node.js v12.0.0 or higher
-
Fork and clone this repository
-
Install the dependencies
- Build the language server
- The newly built server is now located in
./out/server/src/server.js
.
Created: October 19, 2021