mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +02:00
fix(server): Overall bugfixes & improvements
This commit is contained in:
parent
e2c2fac98c
commit
3857bd5694
12
flake.lock
generated
12
flake.lock
generated
@ -26,11 +26,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741396135,
|
"lastModified": 1742209644,
|
||||||
"narHash": "sha256-wqmdLr7h4Bk8gyKutgaApJKOM8JVvywI5P48NuqJ9Jg=",
|
"narHash": "sha256-jMy1XqXqD0/tJprEbUmKilTkvbDY/C0ZGSsJJH4TNCE=",
|
||||||
"owner": "tweag",
|
"owner": "tweag",
|
||||||
"repo": "gomod2nix",
|
"repo": "gomod2nix",
|
||||||
"rev": "0983848bf2a7ccbfe24d874065adb8fd0f23729b",
|
"rev": "8f3534eb8f6c5c3fce799376dc3b91bae6b11884",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -41,11 +41,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741513245,
|
"lastModified": 1742069588,
|
||||||
"narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=",
|
"narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1",
|
"rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,7 +20,6 @@ func TextDocumentDidChange(
|
|||||||
document := sshconfig.DocumentParserMap[params.TextDocument.URI]
|
document := sshconfig.DocumentParserMap[params.TextDocument.URI]
|
||||||
document.Config.Clear()
|
document.Config.Clear()
|
||||||
|
|
||||||
println("reparsing everything")
|
|
||||||
diagnostics := make([]protocol.Diagnostic, 0)
|
diagnostics := make([]protocol.Diagnostic, 0)
|
||||||
errors := document.Config.Parse(content)
|
errors := document.Config.Parse(content)
|
||||||
|
|
||||||
|
@ -35,10 +35,14 @@ func (t *iPv4Tree) addHostBits(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *iPv4Tree) getFromHostBits(hostBits []bool) *context.Context {
|
func (t *iPv4Tree) getFromHostBits(hostBits []bool) *context.Context {
|
||||||
if t.Context != nil || len(hostBits) == 0 {
|
if t.Context != nil {
|
||||||
return &t.Context
|
return &t.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(hostBits) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if hostBits[0] {
|
if hostBits[0] {
|
||||||
if t.TrueNode == nil {
|
if t.TrueNode == nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -31,8 +31,8 @@ func TestPartialHostIpAddresses(t *testing.T) {
|
|||||||
hostSet.AddIP(netip.MustParsePrefix("10.0.0.2/32"), context.Background())
|
hostSet.AddIP(netip.MustParsePrefix("10.0.0.2/32"), context.Background())
|
||||||
hostSet.AddIP(netip.MustParsePrefix("10.0.0.3/32"), context.Background())
|
hostSet.AddIP(netip.MustParsePrefix("10.0.0.3/32"), context.Background())
|
||||||
|
|
||||||
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.1/16")); ctx == nil {
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.1/16")); ctx != nil {
|
||||||
t.Fatalf("Expected to find 10.0.0.1/16 in the host set")
|
t.Fatalf("Didn't expect to find 10.0.0.1/16 in the host set")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("192.168.0.1/16")); ctx != nil {
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("192.168.0.1/16")); ctx != nil {
|
||||||
@ -48,12 +48,24 @@ func TestMixedHostIpAddresses(t *testing.T) {
|
|||||||
hostSet.AddIP(netip.MustParsePrefix("192.168.0.1/32"), context.Background())
|
hostSet.AddIP(netip.MustParsePrefix("192.168.0.1/32"), context.Background())
|
||||||
|
|
||||||
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.2/32")); ctx == nil {
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.2/32")); ctx == nil {
|
||||||
t.Fatalf("Expected to find 10.0.0.3/32 in the host set")
|
t.Fatalf("Expected to find 10.0.0.1/32 in the host set")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("192.168.0.2/32")); ctx != nil {
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("192.168.0.2/32")); ctx != nil {
|
||||||
t.Fatalf("Expected NOT to find 192.168.0.2/32 in the host set")
|
t.Fatalf("Expected NOT to find 192.168.0.2/32 in the host set")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.2/32")); ctx == nil {
|
||||||
|
t.Fatalf("Expected to find 10.0.0.2/32 in the host set")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.1.2/32")); ctx == nil {
|
||||||
|
t.Fatalf("Expected to find 10.0.1.2/32 in the host set")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx, _ := hostSet.ContainsIP(netip.MustParsePrefix("10.0.0.1/30")); ctx == nil {
|
||||||
|
t.Fatalf("Expected to find 10.0.0.1/30 in the host set")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSimpleExactCheck(t *testing.T) {
|
func TestSimpleExactCheck(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user