mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-21 22:54:48 +01:00
chore: slimmed down glue boilerplate
This commit is contained in:
parent
81529bb0b0
commit
c9b9eb2ae1
6 changed files with 13 additions and 67 deletions
|
@ -13,8 +13,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
public class CodeMP {
|
||||
public static Logger LOGGER = LoggerFactory.getLogger(CodeMP.class);
|
||||
|
||||
public static Map<String, Editor> ACTIVE_BUFFERS = new ConcurrentHashMap<>();
|
||||
public static Map<Editor, String> ACTIVE_BUFFERS_REVERSE = new ConcurrentHashMap<>(); //TODO jank
|
||||
public static final Map<String, Editor> ACTIVE_BUFFERS = new ConcurrentHashMap<>();
|
||||
public static final Map<Editor, String> ACTIVE_BUFFERS_REVERSE = new ConcurrentHashMap<>();
|
||||
|
||||
private static boolean loadedLibrary = false;
|
||||
public static void loadLibrary() {
|
||||
|
@ -29,6 +29,7 @@ public class CodeMP {
|
|||
LOGGER.info("Loaded CodeMP library!");
|
||||
loadedLibrary = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.codemp.intellij.exceptions.rust;
|
||||
package com.codemp.intellij.exceptions.lib;
|
||||
|
||||
import com.codemp.intellij.exceptions.CodeMPException;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.codemp.intellij.exceptions.rust;
|
||||
package com.codemp.intellij.exceptions.lib;
|
||||
|
||||
import com.codemp.intellij.exceptions.CodeMPException;
|
||||
|
||||
|
@ -6,4 +6,4 @@ public class InvalidStateException extends CodeMPException {
|
|||
public InvalidStateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.codemp.intellij.exceptions.rust;
|
||||
package com.codemp.intellij.exceptions.lib;
|
||||
|
||||
import com.codemp.intellij.exceptions.CodeMPException;
|
||||
|
||||
|
@ -6,4 +6,4 @@ public class TransportException extends CodeMPException {
|
|||
public TransportException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,3 +27,4 @@ impl ErrorWrapper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ mod error;
|
|||
|
||||
use std::sync::Arc;
|
||||
use codemp::prelude::*;
|
||||
use rifgen::rifgen_attr::{generate_interface, generate_interface_doc};
|
||||
use rifgen::rifgen_attr::{generate_access_methods, generate_interface, generate_interface_doc};
|
||||
use crate::error::ErrorWrapper;
|
||||
|
||||
pub mod glue {
|
||||
pub mod glue { //rifgen generated code
|
||||
include!(concat!(env!("OUT_DIR"), "/glue.rs"));
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ fn convert<T>(result: Result<T, CodempError>) -> Result<T, String> {
|
|||
}
|
||||
|
||||
#[generate_interface_doc]
|
||||
#[generate_access_methods]
|
||||
struct CursorEventWrapper {
|
||||
user: String,
|
||||
buffer: String,
|
||||
|
@ -96,42 +97,6 @@ struct CursorEventWrapper {
|
|||
end_col: i32
|
||||
}
|
||||
|
||||
impl CursorEventWrapper {
|
||||
#[generate_interface(constructor)]
|
||||
fn new() -> CursorEventWrapper {
|
||||
panic!("Default constructor for CursorEventWrapper should never be called!")
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_user(&self) -> &str {
|
||||
&self.user
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_buffer(&self) -> &str {
|
||||
&self.buffer
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_start_row(&self) -> i32 {
|
||||
self.start_row
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_start_col(&self) -> i32 {
|
||||
self.start_col
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_end_row(&self) -> i32 {
|
||||
self.end_row
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_end_col(&self) -> i32 {
|
||||
self.end_col
|
||||
}
|
||||
}
|
||||
|
||||
#[generate_interface_doc]
|
||||
struct CursorHandler {
|
||||
|
@ -171,34 +136,13 @@ impl CursorHandler {
|
|||
}
|
||||
|
||||
#[generate_interface_doc]
|
||||
#[generate_access_methods]
|
||||
struct TextChangeWrapper {
|
||||
start: usize,
|
||||
end: usize, //not inclusive
|
||||
content: String
|
||||
}
|
||||
|
||||
impl TextChangeWrapper {
|
||||
#[generate_interface(constructor)]
|
||||
fn new() -> TextChangeWrapper {
|
||||
panic!("Default constructor for TextChangeWrapper should never be called!")
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_start(&self) -> usize {
|
||||
self.start
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_end(&self) -> usize {
|
||||
self.end
|
||||
}
|
||||
|
||||
#[generate_interface]
|
||||
fn get_content(&self) -> String {
|
||||
self.content.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[generate_interface_doc]
|
||||
struct BufferHandler {
|
||||
#[allow(unused)]
|
||||
|
|
Loading…
Reference in a new issue