mavenversion: 3.5.2javaversion: Open JDK 1.8
Make sure you are using correct maven version and required paths are added to classpath.
The project setup is quite simple. It's a standard maven project.
You can import the project into any ide such as Eclipse or IntelliJ IDEA.
maven will take care of resolving dependencies.
Both these IDE support importing of maven project directly.
Refer to their documentation to know more on how to import maven project in it.
To build project from command line you can use these commands as per your needs.
project-dir is the location where pom.xml is present.
foo@bar:~/poject-dir $ mvn clean # To clean up target directory
foo@bar:~/poject-dir $ mvn package # To generate jar
foo@bar:~/poject-dir $ mvn install # To generate jar and install it local maven repo
foo@bar:~/poject-dir $ mvn clean install # Recommanded way to do a full buildThe issues can broadly classified into 3 categories.
- Feature: A new functionality which needs or requested to be introduced.
- Bug: An unexpected behavior of the functionality
- Task: Routine maintenance task such as adding documentation, upgrading dependencies, verification of functionality etc.
For all the different types the branch name should be prefixed by type of issue plus the id of the issue
followed by / and then make sure the description is in kebab-case
<type>/<id>-<description-in-kebab-case>
For e.g. if you have following issues
- Feature: Add Custom Feature
#10 - Bug: This is not working
#4 - Task: Add more docs
#11
then corresponding branch name will be like these
feat/10-add-custom-feature
bug/4-this-is-not-working
task/11-add-more-docs
Commit message follows the AngularJS commit message conventions.
The conventions is highly standardized and helps in generating CHANGELOG
automatically.
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|ci|chore|types)(\(.+\))?: .{1,50}/
For e.g. if you are working on a feature for autocomplete which you want to commit, it may look like this
feat(autocomplete): list possible xml elements
Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
The footer should contain a closing reference to an issue if any.
If the commit reverts a previous commit, it should begin with revert: , followed by the header of the reverted commit. In the body it should say: This reverts commit <hash>., where the hash is the SHA of the commit being reverted.
Must be one of the following:
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ci: Changes to our CI configuration files and scripts.
- docs: Documentation only changes
- feat: A new feature
- fix: A bug fix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- test: Adding missing tests or correcting existing tests
- chore: A task which needs to be carried out to improve quality of overall repository
The following is the list of supported scopes:
- autocomplete
- hover
- diagnostic
The scope could be any major feature listing which you want to improve or want to introduce. This felxblity allows creating new scopes. But make sure that if you are using a new scope, then don't forget to mention it in the description of scope in PR or in issue comment.
The subject contains a succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end
I strongly recommend all to go through once Example-Language-Server present on VSCode's official documentation to get idea on how a language server and language client works.
A server requires a client to work. So xml-language-server
requires xml-vscode-plugin to work with. The server exposes
all the features such as validations, autocomplete, hover information and other IDE features as a set of json-rpc
endpoints defined in language server specification.
-
Clone both the repo
git clone https://github.com/HandOfGod94/xml-language-server.git # clone language server git clone https://github.com/HandOfGod94/xml-vscode-plugin.git # clone language client
Both in 2 separate directory.
-
Install
VSCode,maven,java,nodeandnpm.
VSCode Version: 1.29.1
Maven Version: 3.5.2
Java SDK Version: 1.8
Node Version: v10.7.0
npm Version: 6.4.1These are the versions which I have used for development.
Refer to their respective docs/websites to know how to install/setup it in local. -
Generate language server jars
Now there are various ways in which you can generate jars.
Thexml-language-servermaven project contains various profiles to work with.# Just generate jar in "target" directory for maven mvn clean package # Genearte jar and install it in local .m2 repo without running tests and style checks # It by default points to "dev" profile mvn clean install # Generate jar, run tests and install it in local .m2 repo mvn clean install -Pdev-with-test # Generate jar, run tests, install, run style checks and generate coverage reports mvn clean install -Pprod
-
Open the xml-vscode-client in VSCode.
-
Hit
F5or go toDebugpanel and clickStartbutton.Note: This step assumes that you used any of the
installcommand in maven and notpackagecommand.
Also the the local .m2 repo is at$HOME_DIR/.m2 -
The current remote debugging port for Java is
8010. You can connect from any ide to this port for Remote debugging.
If you want to change it then it can be modified inxml-vscode-plugin/src/extension.tsfile// Server options let serverOpts: ServerOptions = { run: { command: 'java', args:[ '-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager', '-jar', xmlServerPath ], options: { stdio: 'pipe'}, transport: TransportKind.ipc, }, debug: { command: 'java', args: [ '-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager', '-jar', //Modify the address to change the debugging port '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,quiet=y,address=8010', debugXmlServerPath ], transport: TransportKind.ipc, } };
Steps 1-3 remains same as above. The only difference is that you can use package command also, which
was not the case in the former setup.
-
Once you have the jar, place it inside
xml-vscode-plugin/jarsdirectory. -
Generate
.vsixfilevsce package
-
Install the
.vsixfile.Note.: This requires
codecommand to be available in the system pathcode --install-extension <path-to-vsix-file>
Now you will get extension in the vscode extension list.
Happy Coding !!!
