Giter Club home page Giter Club logo

vscode-kanata's Issues

error reporting cmd is not enabled while it is

VS Code version OS Extension version
1.84.2 Win 10 x64 pro (french) 21H2 v0.4.0

Test this config

(defcfg
	process-unmapped-keys yes
	danger-enable-cmd yes
	log-layer-changes yes
)

(defsrc
	esc
)

(defalias
	esc (tap-hold 200 200 f (cmd cmd /k "echo test"))
)

(deflayer base
	@esc
)

It reports error line 12 cmd is not enabled but cmd action is specified somewhere.

BUG: repeat declaration of key in defsrc

VS Code version OS Extension version
1.84.2 Win 10 x64 pro (french) 21H2 v0.3.0

Steps to reproduce

Try this config

(defcfg
	process-unmapped-keys yes
	log-layer-changes yes
)

(deflocalkeys-win
	lock 8
)

(defsrc
	lock
        7
)

(deflayer base
	_
        _
)

Results

It runs with no error in kanata but triggers the error in extension.

[{
	"resource": "/E:/OneDrive/Téléchargements/test.kbd",
	"owner": "Kanata Configuration Language",
	"severity": 8,
	"message": "Unknown key in defsrc: \"lock\"",
	"source": "kanata-parser",
	"startLineNumber": 11,
	"startColumn": 2,
	"endLineNumber": 11,
	"endColumn": 6
}]

I suspect the OSCode (base 10) is confused with scancode. In lock 8, 8 is the OSCode (base 10). The scancode for key 7 is 08.

With the key tester, 8 is for backspace and 55 is for key_7. It confirms there is no conflicts between the keys.
image

Unknown key in defsrc while it is defined in deflocalkeys

VS Code version OS Extension version
1.82.3 Win 10 x64 pro (french) 22H2 v0.2.0

Steps to reproduce

  1. Check this config.
  2. save in VSCode

Results

[{
	"resource": "/D:/Programmes/Kanata/kanata.kbd",
	"owner": "Kanata Configuration Language",
	"severity": 8,
	"message": "Unknown key in defsrc: \"²\"",
	"source": "kanata-parser",
	"startLineNumber": 216,
	"startColumn": 3,
	"endLineNumber": 216,
	"endColumn": 4
}]

Expectations

When checking defsrc, it seems it doesn’t check in deflocalkeys-win if the key is defined.

Bug: LSP crashes when using `defaliasenvcond` in kanata config

I use your plugin to crate my configuration file but the LSP is not working. I have syntax highlighting but it doesn't show an error. The auto-detect defaultkeys are also not working, but I can choose them myself. For context, I have auto-save on in vscode. I use Windows 11. The file I am using is the default configure file in the Kanata docs repo because I was testing it.

Bug: Empty deflayer causes formatter crash

panicked at src/formatter/defsrc_layout/mod.rs:47:16:
attempt to subtract with overflow

Stack:

Error
    at /home/n/.vscode/extensions/rszyma.vscode-kanata-0.11.21/out/server.js:37:2918
    at X (/home/n/.vscode/extensions/rszyma.vscode-kanata-0.11.21/out/server.js:34:424)
    at S.exports.__wbg_new_abda76e883ba8a5f (/home/n/.vscode/extensions/rszyma.vscode-kanata-0.11.21/out/server.js:37:2899)
    at kls.wasm.console_error_panic_hook::Error::new::ha842e8090e6bbecd (wasm://wasm/kls.wasm-01bd220a:wasm-function[11743]:0x4e4ab6)
    at kls.wasm.console_error_panic_hook::hook_impl::h49cd7ab8835e94ec (wasm://wasm/kls.wasm-01bd220a:wasm-function[2663]:0x366209)
    at kls.wasm.console_error_panic_hook::hook::h1cdcb3fd683dbf05 (wasm://wasm/kls.wasm-01bd220a:wasm-function[14432]:0x50cfcd)
    at kls.wasm.core::ops::function::Fn::call::h63f1386438e14437 (wasm://wasm/kls.wasm-01bd220a:wasm-function[12283]:0x4ee0fb)
    at kls.wasm.std::panicking::rust_panic_with_hook::h32c80a64fe4de396 (wasm://wasm/kls.wasm-01bd220a:wasm-function[4928]:0x409d4c)
    at kls.wasm.std::panicking::begin_panic_handler::{{closure}}::hd496964d114e98b9 (wasm://wasm/kls.wasm-01bd220a:wasm-function[6788]:0x4602b5)
    at kls.wasm.std::sys_common::backtrace::__rust_end_short_backtrace::h0d4686a7fe3981a4 (wasm://wasm/kls.wasm-01bd220a:wasm-function[16251]:0x51df41)


[Error - 5:29:31 PM] Request textDocument/formatting failed.

Reproductible with config:

(deflayer )

Enabling formatter results an error

If i enable formatter in settings, when trying to save I get this error:

recursive use of an object detected which would lead to unsafe aliasing in rust

[Error - 10:40:59 PM] Request textDocument/formatting failed.
  Message: Request textDocument/formatting failed with message: unreachable
  Code: -32603 
[Error - 10:41:00 PM] Notification handler 'textDocument/didSave' failed with message: recursive use of an object detected which would lead to unsafe aliasing in rust
[Error - 10:41:00 PM] Request textDocument/formatting failed.
  Message: Request textDocument/formatting failed with message: recursive use of an object detected which would lead to unsafe aliasing in rust
  Code: -32603 
[Error - 10:41:00 PM] Notification handler 'textDocument/didSave' failed with message: recursive use of an object detected which would lead to unsafe aliasing in rust

Bug: formatter not working when `template-expand` is used in `defsrc` or `deflayer`

e.g. this defsrc will stop any formatting because currently validity of defsrc is checked by counting number of items, without expanding accounting for expanded number of items after template-expand.

(defsrc
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  caps (template-expand home-row j)                            ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           spc            ralt rmet rctl
)

Similarly, template-expand will not format deflayers with template-expand for the same reason.

formatter crash

panicked at src/formatter/use_defsrc_layout_on_deflayers.rs:252:34:
line comment inside deflayer should always have newline

this config causes crash:

(defsrc
  a b c
)
(deflayer base
  a b ;;
  c
)

while this doesn't:

(defsrc
  a b c
)
(deflayer base
  a b ;;
  c)

Bug: crash when including file that doesn't exist

panicked at src/formatter/defsrc_layout/get_layout.rs:67:22:
document should be cached

Stack:

Error
    at S.exports.__wbg_new_abda76e883ba8a5f (/home/n/.vscode/extensions/rszyma.vscode-kanata-0.9.25/out/server.js:34:2247)
    at wasm://wasm/004bdb72:wasm-function[1091]:0xd7f5c
    at wasm://wasm/004bdb72:wasm-function[508]:0xc41a4
    at wasm://wasm/004bdb72:wasm-function[763]:0xd3983
    at wasm://wasm/004bdb72:wasm-function[688]:0xcdffc
    at wasm://wasm/004bdb72:wasm-function[84]:0x6dfc7
    at as.onDocumentFormatting (/home/n/.vscode/extensions/rszyma.vscode-kanata-0.9.25/out/server.js:34:812)
    at /home/n/.vscode/extensions/rszyma.vscode-kanata-0.9.25/out/server.js:34:6367
    at /home/n/.vscode/extensions/rszyma.vscode-kanata-0.9.25/out/server.js:33:77865
    at ni (/home/n/.vscode/extensions/rszyma.vscode-kanata-0.9.25/out/server.js:3:9548)


[Error - 7:07:49 PM] Request textDocument/formatting failed.
  Message: Request textDocument/formatting failed with message: unreachable
  Code: -32603 

Steps to reproduce:

  1. Open in workspace mode (not sure it it's only in workspace)
  2. include file that doesn't exist.
  3. vscode-kanata crashes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.