Skip to content

Commit 864b4f5

Browse files
committed
Restructure the folders
1 parent 589cf60 commit 864b4f5

File tree

142 files changed

+481
-531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+481
-531
lines changed

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
group 'org.example'
2-
version '1.0-SNAPSHOT'
3-
1+
version project.version
42
apply plugin: 'java'
5-

client/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
group 'org.example'
2-
version '1.0-SNAPSHOT'
3-
1+
version project.version

client/ls-client/src/extension.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { execSync } from 'child_process';
1+
import { execSync, exec, spawnSync } from 'child_process';
22
import { ChildProcess, spawn } from 'mz/child_process';
33
import * as vscode from 'vscode';
44
import * as path from 'path';
@@ -7,8 +7,8 @@ import { LanguageClient, LanguageClientOptions, ServerOptions, StreamInfo } from
77

88
export function activate(context: vscode.ExtensionContext) {
99
var logChannel = vscode.window.createOutputChannel("Bal_LSP_and_Impl");
10-
const main: string = 'org.lsp.launcher.stdio.StdioLauncher';
11-
const tcpMain: string = 'org.lsp.launcher.tcp.TCPLauncher'
10+
const main: string = 'com.lspandimpl.launcher.stdio.StdioLauncher';
11+
const tcpMain: string = 'TCPLauncher'
1212
logChannel.appendLine("Starting the Ballerina Language Server Extension!");
1313

1414
getJavaHome().then(val => {
@@ -18,8 +18,8 @@ export function activate(context: vscode.ExtensionContext) {
1818

1919
let classPath = path.join(__dirname, '..', '*');
2020
const args: string[] = ['-cp', classPath];
21-
let BAL_HOME = "/Users/nadeeshaan/Development/BalWS/jballerina-tools-2.0.0-beta.4-SNAPSHOT";
22-
args.push('-Dballerina.home=' + BAL_HOME);
21+
let ballerinaHome = getBallerinaHome();
22+
args.push('-Dballerina.home=' + ballerinaHome);
2323
if (process.env.LSDEBUG === "true") {
2424
logChannel.appendLine('LSDEBUG is set to "true". Language Server is starting on debug mode');
2525
args.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005,quiet=y');
@@ -106,3 +106,24 @@ function getJavaHome() {
106106
}
107107
});
108108
}
109+
110+
function getBallerinaHome() {
111+
let cmd: string;
112+
113+
if (process.platform == 'win32') {
114+
cmd = 'java -XshowSettings:properties -version 2>&1 | findstr "java.home"';
115+
} else {
116+
cmd = "bal home";
117+
}
118+
119+
try {
120+
let response = spawnSync('bal', ['home']);
121+
if (response.stdout.length > 0) {
122+
return response.stdout.toString().trim();
123+
}
124+
} catch (er) {
125+
if (er instanceof Error) {
126+
return "Failed"
127+
}
128+
}
129+
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
project.version='1.2.2'
1+
version=1.0.0-SNAPSHOT
2+
group=com.lspandimpl

launchers/build.gradle

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ plugins {
22
id 'java'
33
}
44

5-
group 'org.example'
6-
version '1.0-SNAPSHOT'
7-
8-
ext {
9-
lsp4jVersion = "0.12.0"
10-
ballerinaLangVersion = "2.0.0-beta.3"
11-
}
5+
version project.version
126

137
repositories {
148
mavenCentral()
@@ -36,7 +30,7 @@ test {
3630

3731
task copyArtifacts(type: Copy) {
3832
dependsOn 'uberJar'
39-
from "$buildDir/libs/launchers-1.0-SNAPSHOT-uber.jar"
33+
from "$buildDir/libs/launchers-$project.version-uber.jar"
4034
into "../client/ls-client/"
4135
}
4236

launchers/src/main/java/org/lsp/launcher/stdio/StdioLauncher.java renamed to launchers/src/main/java/com/lspandimpl/launcher/stdio/StdioLauncher.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.lsp.launcher.stdio;
16+
package com.lspandimpl.launcher.stdio;
1717

1818
import org.eclipse.lsp4j.jsonrpc.Launcher;
1919
import org.eclipse.lsp4j.launch.LSPLauncher;
2020
import org.eclipse.lsp4j.services.LanguageClient;
21-
import org.eclipse.lsp4j.services.LanguageClientAware;
22-
import org.lsp.server.core.BalLanguageServer;
21+
import com.lspandimpl.server.core.BalLanguageServer;
2322

2423
import java.io.InputStream;
2524
import java.io.OutputStream;

launchers/src/main/java/org/lsp/launcher/tcp/TCPLauncher.java renamed to launchers/src/main/java/com/lspandimpl/launcher/tcp/TCPLauncher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package org.lsp.launcher.tcp;
1+
package com.lspandimpl.launcher.tcp;
22

33
import org.eclipse.lsp4j.jsonrpc.Launcher;
44
import org.eclipse.lsp4j.launch.LSPLauncher;
55
import org.eclipse.lsp4j.services.LanguageClient;
6-
import org.lsp.server.core.BalLanguageServer;
6+
import com.lspandimpl.server.core.BalLanguageServer;
77

88
import java.io.IOException;
99
import java.io.InputStream;

server/server-api/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
group 'org.lsp.server.api'
2-
version '1.0-SNAPSHOT'
1+
version project.version
32

43
dependencies {
54
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'

server/server-api/src/main/java/org/lsp/server/api/ClientLogManager.java renamed to server/server-api/src/main/java/com/lspandimpl/server/api/ClientLogManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.lsp.server.api;
1+
package com.lspandimpl.server.api;
22

33
public interface ClientLogManager {
44
/**

server/server-api/src/main/java/org/lsp/server/api/ConfigurationHolder.java renamed to server/server-api/src/main/java/com/lspandimpl/server/api/ConfigurationHolder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.lsp.server.api;
1+
package com.lspandimpl.server.api;
22

33
import com.google.gson.JsonElement;
44

0 commit comments

Comments
 (0)