-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from aws/breedloj/lspClientInfo
Pass client information to LSPs for user agent
- Loading branch information
Showing
27 changed files
with
389 additions
and
337 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
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,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false"> | ||
<fileset name="all" enabled="true" check-config-name="Copy of Sun Checks" local="false"> | ||
<file-match-pattern match-pattern="." include-pattern="true"/> | ||
</fileset> | ||
</fileset-config> |
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
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
41 changes: 0 additions & 41 deletions
41
plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/AuthLspConnectionProvider.java
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/LspConnectionProvider.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...c/software/aws/toolkits/eclipse/amazonq/lsp/connection/AbstractLspConnectionProvider.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 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package software.aws.toolkits.eclipse.amazonq.lsp.connection; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; | ||
import org.eclipse.lsp4e.server.StreamConnectionProvider; | ||
|
||
public abstract class AbstractLspConnectionProvider extends ProcessStreamConnectionProvider implements StreamConnectionProvider { | ||
|
||
protected AbstractLspConnectionProvider() throws IOException { | ||
setWorkingDirectory(System.getProperty("user.dir")); | ||
} | ||
|
||
@Override | ||
protected final ProcessBuilder createProcessBuilder() { | ||
final var builder = new ProcessBuilder(getCommands()); | ||
if (getWorkingDirectory() != null) { | ||
builder.directory(new File(getWorkingDirectory())); | ||
} | ||
builder.redirectError(ProcessBuilder.Redirect.INHERIT); | ||
addEnvironmentVariables(builder.environment()); | ||
return builder; | ||
} | ||
|
||
protected abstract void addEnvironmentVariables(Map<String, String> env); | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...n/src/software/aws/toolkits/eclipse/amazonq/lsp/connection/AuthLspConnectionProvider.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,33 @@ | ||
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package software.aws.toolkits.eclipse.amazonq.lsp.connection; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import software.aws.toolkits.eclipse.amazonq.providers.LspManagerProvider; | ||
import software.aws.toolkits.eclipse.amazonq.util.PluginUtils; | ||
|
||
public class AuthLspConnectionProvider extends AbstractLspConnectionProvider { | ||
|
||
public AuthLspConnectionProvider() throws IOException { | ||
super(); | ||
var authJs = PluginUtils.getResource("auth/packages/server/dist/index.js"); | ||
var lspManager = LspManagerProvider.getInstance(); | ||
|
||
List<String> commands = new ArrayList<>(); | ||
commands.add(lspManager.getLspInstallation().nodeExecutable().toString()); | ||
commands.add(authJs.getPath()); | ||
commands.add("--nolazy"); | ||
commands.add("--inspect=5599"); | ||
commands.add("--stdio"); | ||
setCommands(commands); | ||
} | ||
|
||
@Override | ||
protected void addEnvironmentVariables(final Map<String, String> env) { } | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/connection/QLspConnectionProvider.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,34 @@ | ||
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package software.aws.toolkits.eclipse.amazonq.lsp.connection; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import software.aws.toolkits.eclipse.amazonq.lsp.manager.LspManager; | ||
import software.aws.toolkits.eclipse.amazonq.providers.LspManagerProvider; | ||
|
||
public class QLspConnectionProvider extends AbstractLspConnectionProvider { | ||
|
||
public QLspConnectionProvider() throws IOException { | ||
super(); | ||
LspManager lspManager = LspManagerProvider.getInstance(); | ||
List<String> commands = new ArrayList<>(); | ||
commands.add(lspManager.getLspInstallation().nodeExecutable().toString()); | ||
commands.add(lspManager.getLspInstallation().lspJs().toString()); | ||
commands.add("--nolazy"); | ||
commands.add("--inspect=5599"); | ||
commands.add("--stdio"); | ||
setCommands(commands); | ||
} | ||
|
||
@Override | ||
protected final void addEnvironmentVariables(final Map<String, String> env) { | ||
env.put("ENABLE_INLINE_COMPLETION", "true"); | ||
env.put("ENABLE_TOKEN_PROVIDER", "true"); | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
plugin/src/software/aws/toolkits/eclipse/amazonq/providers/LspManagerProvider.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,39 @@ | ||
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package software.aws.toolkits.eclipse.amazonq.providers; | ||
|
||
import software.aws.toolkits.eclipse.amazonq.lsp.manager.DefaultLspManager; | ||
import software.aws.toolkits.eclipse.amazonq.lsp.manager.LspConstants; | ||
import software.aws.toolkits.eclipse.amazonq.lsp.manager.LspManager; | ||
import software.aws.toolkits.eclipse.amazonq.lsp.manager.fetcher.RemoteManifestLspFetcher; | ||
|
||
public final class LspManagerProvider { | ||
|
||
private LspManagerProvider() { | ||
// prevent instantiation | ||
} | ||
|
||
private static LspManager instance; | ||
|
||
public static LspManager getInstance() { | ||
if (instance == null) { | ||
synchronized (LspManagerProvider.class) { | ||
if (instance == null) { | ||
instance = createLspManager(); | ||
} | ||
} | ||
} | ||
return instance; | ||
} | ||
|
||
private static LspManager createLspManager() { | ||
return DefaultLspManager.builder() | ||
.withLspExecutablePrefix(LspConstants.CW_LSP_FILENAME) | ||
.withFetcher(RemoteManifestLspFetcher.builder() | ||
.withManifestUrl(LspConstants.CW_MANIFEST_URL) | ||
.build()) | ||
.build(); | ||
} | ||
|
||
} |
Oops, something went wrong.