Git Product home page Git Product logo

lemminx's Issues

Completion settings

Add completion settings (like client snippet support) when completion is done.

Add support for `textDocument/documentLink`

Add support for textDocument/documentLink https://microsoft.github.io/language-server-protocol/specification#textDocument_documentLink for extension.

One extension for web (web.xml) could manage hyperlink for welcome-file to open it:

<welcome-file-list>
     <welcome-file>index.jsp</welcome-file>
     <welcome-file>index.html</welcome-file>
</welcome-file-list>

One extension for String could manage hyperlink for class to open the Java class:

<bean class="MyClass" />

Basic XML validation for no well XML

I don't know if it's an hard task, but I tell me if we could use our XML scanner to validate XML files for no well XML (XML which doesn't end an element tag, etc).

Today, I'm using Xerces to do that, but the main problem is that SAXParserException contains only a start line/character and not the end.

I have studied WTP XML validator and they do like this:

The benefit to do that is that you can highlight the element tag when there is an error.

For the XML Schema error, WTP adjust the start/end location according error message like https://github.com/microclimate-devops/xml-language-server does too.

I would like to follow the same idea than WTP/XML Editor:

  • manage basic XML validation with our XML Scanner tokens. This feature will be managed in the core.
  • manage validation based on XML Schema, DTD, etc with Xerces. Those features will be move to contentmodel extension project.

IMHO, if we can do that, we will have a clean validation mean and it will be easy to extend too validation to valiudate other things (ex: validate java class defines in @Class attribute, etc)

@fbricon @NikolasKomonen what do you think about that?

Adjust range for XML syntax errors

@NikolasKomonen if you wish to work on adjust range for XML syntax errors, please do that in https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/contentmodel/participants/diagnostics/XMLSyntaxErrorCode.java

You can find XML Syntax/Schema error code list at https://wiki.xmldation.com/Support/Validator/. You must filter thoses codes and keep just XML Syntax error code. Me I'm working on XML Schema error code in #72

Please update tests at https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/contentmodel/XMLSyntaxDiagnosticsTest.java

To check the adjust to do, I suggest you to consume the lsp4xml language server inside vscode and see if it highlights attributes value, name, elements, etc according the XML syntax error code.

Good luck!

Scanner does not handle unclosed tags well

If a tag is not properly closed eg <tag </tag> the scanner will not be smart enough to recognise the start of a new tag.

The scanner should search for the closing tag, while also checking if it sees a new opening tag.
This will be helpful since it will indicate and un-closed tag to every service that uses the Scanner and will prevent incorrect Node structures, Incorrect Document Validations, Formatting...

At most the Scanner will return the new opening bracket Token (eg '<') instead of the wrong closing bracket Token.

Support for XML associations

Gives the capability to assocoiate a give file (ex : .project, .classpath) with a XML Schema to benefit with compeltion and validatioin. Indeed Eclispe files .project, .classpath doesn't define an XML Schema in their root. Associate a XMl Schema with a given file name pattern could be helpful.

The question is about file pattern. We could manage at hand '*' pattern like https://github.com/microclimate-devops/xml-language-server/blob/master/server/xml-server/src/com/ibm/ctools/ls/xml/XMLLanguageServer.java#L119 does but I find it's a little limitaed.

My idea @fbricon @NikolasKomonen is to support minimatch pattern with my Minimatch port in Java https://github.com/angelozerr/minimatch.java

Are you OK with this new dependency?

Don't log to System.err/out

... or call exception.printStackTrace();

stdio is used to exchange messages with the client. Logging to standard streams will break the client/server communication.

Either log messages via a logging facade (slf4j?) to a log file, and/or log messages to the client

Use another package name than `org.eclipse.xml`

The package name is org.eclipse.xml.... Typical Eclipse projects use an org.eclipse.<projectName> as root package. To avoid necessary further refactoring when moving to Eclipse.org, we should consider deciding of a projectName already and adopt this in package name asap.

Split XMLDocument into XMLDocument and TextDocument

XMLDocument provides usefull method like Position positionAt(int position). Some support (like folding, format) doesn't requires the use of XML node, so we parse XML document although we don't need it.

The idea of this issue is to have 2 structures:

  • a TextDocument which provides positionAt, etc
  • XMLDocument which maintains Node structure (and could be initalized with TextDocument to keep positionAt methods)

LoggerTest fails on Windows OS

In Windows OS, when I execute it, I have this error:

Running org.eclipse.lsp4xml.utils.LoggerTest
août 09, 2018 4:52:10 PM org.eclipse.lsp4xml.utils.LoggerTest testLogCreated
GRAVE: @@Log Message@@
Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec <<< FAILURE!
assertTestFormatting(org.eclipse.lsp4xml.utils.LoggerTest)  Time elapsed: 0.001 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[Sep 16, 1997 04:05:05 org.my.test.Class mySourceMethod()
Message: Formatting Log Message
	at declaringClass.methodName(fileName.java:1)
	at declaringClass2.methodName2.drl.java(fileName2.java:2)
	at declaringClass.methodName.apk.java(fileName:3)]
> but was:<[sept. 16, 1997 04:05:05 org.my.test.Class mySourceMethod()
Message: Formatting Log Message
	at declaringClass.methodName(fileName.java:1)
	at declaringClass2.methodName2.drl.java(fileName2.java:2)
	at declaringClass.methodName.apk.java(fileName:3)
]
>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at org.eclipse.lsp4xml.utils.LoggerTest.assertTestFormatting(LoggerTest.java:131)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

@fbricon @NikolasKomonen could you fix this problem please? It seems that date are hard coded in the JUnit test. Thanks!

Parser doesn't consider CDATA

It looks like the parser does not handle CDATA, I'm currently working on implementing this. Let me know if there is anything you would like to discuss.

[Request] Document Formatting

It should be nice to have a formatting XML support. Format should be done:

  • for the whole XML document
  • for selected content of XML document

There are 2 strategies to do that:

We need too defines formatting preferences. Here the WTP/ XML Editor preferences:

image

You can find it at https://github.com/eclipse/webtools.sourceediting/blob/master/xml/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/formatter/XMLFormattingPreferences.java

Interaction with Eclipse WTP.XML

I see as part of this project tries to implement it's own parser. I think it's a really hard task from short to long term!
Have you consider re-using Eclipse WTP parser or some other parser (like the one used by IntelliJ) to build the server upon?

Add JUnit for tolerant XMLParser

Add JUnit for tolerant XMLParser

@NikolasKomonen please follow this issue to track JUnit that I will do. Once I will push my work, please give me feedback to know if you will like tests and do the same thing for CDATA #5

Maven wrapper breaks the build

Build failed every time https://travis-ci.org/angelozerr/lsp4xml/builds/422519278?utm_source=email&utm_medium=notification because of

3.45s$ ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
--2018-08-30 12:05:36--  https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar
Resolving repo.maven.apache.org (repo.maven.apache.org)... 151.101.20.215
Connecting to repo.maven.apache.org (repo.maven.apache.org)|151.101.20.215|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2018-08-30 12:05:36 ERROR 403: Forbidden.

@fbricon have you an idea about this problem?

Enable ClientLogHandler with param

Today ClientLogHandler is every time enabled. I don't know if it is the wished behaviour.

If we see the code of LogHelper, the initializationObject cannot be never null (empty but not null)

	public static void initializeRootLogger(LanguageClient newLanguageClient, Map<?, ?> initializationObject) {
		if(newLanguageClient == null || initializationObject == null) {
			return;
		}

So the following code which enable )ClientHandler is done evry time.


	Logger logger = Logger.getLogger("");
		unregisterAllHandlers(logger.getHandlers());
		logger.setLevel(Level.SEVERE);
		logger.setUseParentHandlers(false);// Stops output to console

		try {
			logger.addHandler(LogHelper.getClientHandler(newLanguageClient));
		} catch (Exception e) {
			// TODO: handle exception
		}

To fix that, I think we should:

  • check like this:

if(newLanguageClient == null || initializationObject == null || initializationObject.isEmpty()) {

  • use property

    • lsp4xml.logs.client.enabled to know if client must be enabled or not
    • lsp4xml.logPath should be perhaps replaced with lsp4xml.logs.file.path

What do you think about that?

Emmet Extension

It should be cool if we could have Emmet support by providing a new Emmet Extension like it exists for teh vscode html language server:

emmetdemo

Guys, it's just an idea, please vote if you like it. Thanks!

Add support for `textDocument/references` for XML Schema types

Add support for textDocument/references https://microsoft.github.io/language-server-protocol/specification#textDocument_references for extension

One extension for XSD could find the references of xs:complexType (references by xs:element, etc) :

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://maven.apache.org/POM/4.0.0" targetNamespace="http://maven.apache.org/POM/4.0.0">
  <xs:element name="project" type="Model">
...
  </xs:element>
  <xs:complexType name="Model">

A Find References did in the "Model" of txs:complexType shoudl return xs:element

Here a references demo with XMLSchema.xsd

XSDReferenceDemo

The references should work with other element like:

  • xs:complexType
  • xs:simpleType
  • xs:element
  • xs:group

Add delay for didChange

When modifying the document textDocument/didChange will trigger on each keystroke even if done together quickly. This also ends up triggering validation each time.

A fix, similar to jdtls, should help speed everything up. Unless this whole issue is already handled by something I missed.

Comments are not considered in Formatting

The XMLScanner is setup for comments, but it is not handled in XMLFormatting, formatting will remove the comments.

To fix add consideration of comments in XMLParser

Give more settings for Format

It should be cool to give the capability to customize formatting. We need to collect which settings we need and implement the formatting with thoses settings.

Here settings for WTP/XML Editor:

image

Here the HTML formatting option for vscode html language service https://github.com/Microsoft/vscode-html-languageservice/blob/master/src/services/htmlFormatter.ts#L55

let htmlOptions: IBeautifyHTMLOptions = {
		indent_size: options.insertSpaces ? tabSize : 1,
		indent_char: options.insertSpaces ? ' ' : '\t',
		wrap_line_length: getFormatOption(options, 'wrapLineLength', 120),
		unformatted: getTagsFormatOption(options, 'unformatted', void 0),
		content_unformatted: getTagsFormatOption(options, 'contentUnformatted', void 0),
		indent_inner_html: getFormatOption(options, 'indentInnerHtml', false),
		preserve_newlines: getFormatOption(options, 'preserveNewLines', true),
		max_preserve_newlines: getFormatOption(options, 'maxPreserveNewLines', 32786),
		indent_handlebars: getFormatOption(options, 'indentHandlebars', false),
		end_with_newline: includesEnd && getFormatOption(options, 'endWithNewline', false),
		extra_liners: getTagsFormatOption(options, 'extraLiners', void 0),
		wrap_attributes: getFormatOption(options, 'wrapAttributes', 'auto'),
		wrap_attributes_indent_size: getFormatOption(options, 'wrapAttributesIndentSize', void 0),
		eol: '\n'
	};

@NikolasKomonen do you want to work on this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.