-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support compiling and pushing diagnostics (#962)
- Loading branch information
Showing
5 changed files
with
162 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
gradle-language-server/src/main/java/com/microsoft/gradle/compile/GradleCompilationUnit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package com.microsoft.gradle.compile; | ||
|
||
import java.security.CodeSource; | ||
|
||
import org.codehaus.groovy.control.CompilationUnit; | ||
import org.codehaus.groovy.control.CompilerConfiguration; | ||
|
||
import groovy.lang.GroovyClassLoader; | ||
|
||
public class GradleCompilationUnit extends CompilationUnit { | ||
private Integer version; | ||
|
||
public GradleCompilationUnit(CompilerConfiguration configuration, CodeSource codeSource, GroovyClassLoader loader, Integer version) { | ||
super(configuration, codeSource, loader); | ||
this.version = version; | ||
} | ||
|
||
public Integer getVersion() { | ||
return this.version; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
gradle-language-server/src/main/java/com/microsoft/gradle/utils/LSPUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package com.microsoft.gradle.utils; | ||
|
||
import org.codehaus.groovy.syntax.SyntaxException; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.lsp4j.Range; | ||
|
||
public class LSPUtils { | ||
public static Range toRange(SyntaxException exp) { | ||
// LSP Range start from 0, while groovy classes start from 1 | ||
return new Range(new Position(exp.getStartLine() - 1, exp.getStartColumn() - 1), | ||
new Position(exp.getEndLine() - 1, exp.getEndColumn() - 1)); | ||
} | ||
} |