Skip to content

Commit 00a76b8

Browse files
committed
Fix gopls codeLens commands to include the gopls prefix that it now sends (autozimu#1131)
1 parent 159eade commit 00a76b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/extensions/gopls.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ use serde::Deserialize;
55
use serde_json::Value;
66

77
pub mod command {
8-
pub const TEST: &str = "test";
9-
pub const GENERATE: &str = "generate";
8+
// older versions of gopls send code lens commands without the `gopls` prefix
9+
// so probably a good idea to maintain both for a while.
10+
pub(super) const TEST: &str = "test";
11+
pub(super) const GOPLS_TEST: &str = "gopls.test";
12+
pub(super) const GENERATE: &str = "generate";
13+
pub(super) const GOPLS_GENERATE: &str = "gopls.generate";
1014
}
1115

1216
impl LanguageClient {
1317
pub fn handle_gopls_command(&self, cmd: &Command) -> Result<bool> {
1418
match cmd.command.as_str() {
15-
command::TEST => {
19+
command::TEST | command::GOPLS_TEST => {
1620
if let Some(args) = &cmd.arguments {
1721
if let Some(file) = args.get(0) {
1822
let file = String::deserialize(file)?;
@@ -40,7 +44,7 @@ impl LanguageClient {
4044
}
4145
}
4246
}
43-
command::GENERATE => {
47+
command::GENERATE | command::GOPLS_GENERATE => {
4448
if let Some(arguments) = &cmd.arguments {
4549
if let Some(package) = arguments.get(0) {
4650
let package = String::deserialize(package)?;

0 commit comments

Comments
 (0)