Skip to content

Commit ed4f0df

Browse files
committed
LS activate events
1 parent d693fdd commit ed4f0df

7 files changed

Lines changed: 67 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.1.1] - 2026-01-11
9+
10+
### Fixes
11+
12+
* BASIC servers respond to window activation event
13+
* Integer BASIC line reference hovers trigger on the number itself
14+
815
## [4.1.0] - 2026-01-10
916

1017
### Fixes

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "a2kit"
3-
version = "4.1.0"
3+
version = "4.1.1"
44
edition = "2024"
55
readme = "README.md"
66
license = "MIT"

src/bin/server-applesoft/request.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde_json;
77
use std::collections::HashMap;
88
use std::sync::Arc;
99
use a2kit::lang::server::{send_edit_req,Checkpoint,Tokens};
10-
use a2kit::lang::disk_server;
10+
use a2kit::lang::{disk_server,normalize_client_uri_str};
1111
use a2kit::lang::applesoft;
1212
use super::logger;
1313
use super::rpc_error::PARSE_ERROR;
@@ -83,6 +83,22 @@ pub fn handle_request(
8383
lsp::request::ExecuteCommand::METHOD => {
8484
if let Ok(params) = serde_json::from_value::<lsp::ExecuteCommandParams>(req.params) {
8585
match params.command.as_str() {
86+
"applesoft.activeEditorChanged" => {
87+
if params.arguments.len()==1 {
88+
let uri_res = serde_json::from_value::<String>(params.arguments[0].clone());
89+
if let Ok(uri) = uri_res {
90+
let normalized_uri = normalize_client_uri_str(&uri).expect("could not parse URI");
91+
if let Some(chk) = tools.doc_chkpts.get(&normalized_uri.to_string()) {
92+
let handle = crate::launch_analysis_thread(
93+
Arc::clone(&tools.analyzer),
94+
chk.get_doc()
95+
);
96+
tools.thread_handles.push_back(handle);
97+
}
98+
resp = lsp_server::Response::new_ok(req.id,serde_json::Value::Null);
99+
}
100+
}
101+
},
86102
"applesoft.semantic.tokens" => {
87103
if params.arguments.len()==1 {
88104
if let Ok(program) = serde_json::from_value::<String>(params.arguments[0].clone()) {

src/bin/server-integerbasic/request.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use lsp_server::{Connection,RequestId,Response};
66
use serde_json;
77
use std::collections::HashMap;
88
use a2kit::lang::server::{send_edit_req,Checkpoint,Tokens};
9-
use a2kit::lang::disk_server;
9+
use a2kit::lang::{disk_server,normalize_client_uri_str};
1010
use a2kit::lang::integer;
1111
use super::logger;
1212
use super::rpc_error::PARSE_ERROR;
@@ -83,6 +83,22 @@ pub fn handle_request(
8383
lsp::request::ExecuteCommand::METHOD => {
8484
if let Ok(params) = serde_json::from_value::<lsp::ExecuteCommandParams>(req.params) {
8585
match params.command.as_str() {
86+
"integerbasic.activeEditorChanged" => {
87+
if params.arguments.len()==1 {
88+
let uri_res = serde_json::from_value::<String>(params.arguments[0].clone());
89+
if let Ok(uri) = uri_res {
90+
let normalized_uri = normalize_client_uri_str(&uri).expect("could not parse URI");
91+
if let Some(chk) = tools.doc_chkpts.get(&normalized_uri.to_string()) {
92+
let handle = crate::launch_analysis_thread(
93+
Arc::clone(&tools.analyzer),
94+
chk.get_doc()
95+
);
96+
tools.thread_handles.push_back(handle);
97+
}
98+
resp = lsp_server::Response::new_ok(req.id,serde_json::Value::Null);
99+
}
100+
}
101+
},
86102
"integerbasic.semantic.tokens" => {
87103
if params.arguments.len()==1 {
88104
if let Ok(program) = serde_json::from_value::<String>(params.arguments[0].clone()) {

src/cli.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ Set RUST_LOG environment variable to control logging level.
7676
7777
Examples:
7878
---------
79+
smart copy: `a2kit cp myimg.woz/program ./program.bas`
7980
create DOS image: `a2kit mkdsk -o dos33 -v 254 -t woz2 -d myimg.woz`
8081
create ProDOS image: `a2kit mkdsk -o prodos -v disk.new -t woz2 -d myimg.woz`
81-
Language line entry: `a2kit verify -t atxt`
82-
Language file check: `a2kit get -f myprog.bas | a2kit verify -t atxt`
83-
Tokenize to file: `a2kit get -f prog.bas | a2kit tokenize -a 2049 -t atxt > prog.atok
84-
Tokenize to image: `a2kit get -f prog.bas | a2kit tokenize -a 2049 -t atxt \\
82+
language line entry: `a2kit verify -t atxt`
83+
language file check: `a2kit get -f myprog.bas | a2kit verify -t atxt`
84+
detokenize from image: `a2kit get -f prog -t atok -d myimg.dsk | a2kit detokenize -t atok
85+
tokenize to file: `a2kit get -f prog.bas | a2kit tokenize -a 2049 -t atxt > prog.atok
86+
tokenize to image: `a2kit get -f prog.bas | a2kit tokenize -a 2049 -t atxt \\
8587
| a2kit put -f prog -t atok -d myimg.dsk`
86-
Detokenize from image: `a2kit get -f prog -t atok -d myimg.dsk | a2kit detokenize -t atok";
88+
...or smart copy: `a2kit cp -a 2049 prog.bas myimg.dsk";
89+
8790
let img_types = [
8891
"d13", "do", "po", "woz1", "woz2", "imd", "img", "2mg", "nib", "td0",
8992
];
@@ -151,8 +154,14 @@ Detokenize from image: `a2kit get -f prog -t atok -d myimg.dsk | a2kit detokeniz
151154

152155
main_cmd = main_cmd.subcommand(
153156
Command::new("cp")
154-
.arg(Arg::new("paths").num_args(2..=1000).help("sequence of paths, last path is the destination").value_name("PATHS").required(true))
155-
.arg(Arg::new("addr").long("addr").short('a').help("load-address if applicable").value_name("ADDRESS").required(false))
157+
.arg(Arg::new("paths").num_args(2..=1000).help("sequence of paths, last path is the destination").value_name("PATHS").required(true)
158+
.long_help("Paths inside the disk image always use the forward slash.
159+
It is OK to have a mixture such as `c:\\path\\to\\disk.img/path/to/file`.
160+
Recursive glob patterns like `disk.img/**` will expand correctly,
161+
but the files will all go to the same target directory."))
162+
.arg(Arg::new("addr").long("addr").short('a').help("load-address if applicable").value_name("ADDRESS").required(false)
163+
.long_help("Specify the load address that is stored with some Apple file types.
164+
This is only needed for host-to-image copies involving Apple file systems"))
156165
.arg(pro_arg())
157166
.arg(method_arg())
158167
.about("smart copy that formats for the target")

src/lang/integer/hovers/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ impl Navigate for HoverProvider {
9898
}
9999
}
100100

101-
if ["statement_goto", "statement_gosub", "statement_then_line"].contains(&curs.node().kind()) {
102-
if let Some(next) = curs.node().next_named_sibling() {
103-
if let Some(num) = node_integer(&next,&self.line) {
104-
if let Some(docstring) = self.symbols.docstring(num) {
105-
if self.markup.value.len() > 0 {
106-
self.markup.value += "\n\n---\n\n";
101+
if curs.node().kind() == "integer" {
102+
if let Some(prev) = curs.node().prev_named_sibling() {
103+
if ["statement_goto", "statement_gosub", "statement_then_line"].contains(&prev.kind()) {
104+
if let Some(num) = node_integer(&curs.node(),&self.line) {
105+
if let Some(docstring) = self.symbols.docstring(num) {
106+
if self.markup.value.len() > 0 {
107+
self.markup.value += "\n\n---\n\n";
108+
}
109+
self.markup.value += &docstring.to_string();
107110
}
108-
self.markup.value += &docstring.to_string();
109111
}
110112
}
111113
}

src/lang/merlin/assembly.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ pub fn eval_conditional(start_node: &tree_sitter::Node, source: &str, pc: Option
260260
if let Some(grandchild) = child.child(0) {
261261
if grandchild.kind() == "var_mac" || (grandchild.kind() == "var_cnt" && symbols.assembler != MerlinVersion::Merlin8) {
262262
// induce a deferred evalution
263-
// TODO: the parser has to be changed to produce var_cnt
264263
return Err(Box::new(Error::ExpressionEvaluation));
265264
}
266265
}

0 commit comments

Comments
 (0)