mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-19 07:25:27 +02:00
fix(wireguard): Improvements
This commit is contained in:
parent
b08a5b68bf
commit
d456f4a569
@ -134,7 +134,7 @@ func (p *wireguardParser) parseFromString(input string) []lineError {
|
||||
return errors
|
||||
}
|
||||
|
||||
func (p *wireguardParser) getTypeByLine(line uint32) lineType {
|
||||
func (p wireguardParser) getTypeByLine(line uint32) lineType {
|
||||
// Check if line is a comment
|
||||
if _, found := p.CommentLines[line]; found {
|
||||
return LineTypeComment
|
||||
@ -168,13 +168,10 @@ func (p *wireguardParser) getTypeByLine(line uint32) lineType {
|
||||
// [Peer]
|
||||
//
|
||||
// This would return the section [Interface]
|
||||
func (p *wireguardParser) getBelongingSectionByLine(line uint32) *wireguardSection {
|
||||
// Create a copy
|
||||
sections := append([]wireguardSection{}, p.Sections...)
|
||||
func (p wireguardParser) getBelongingSectionByLine(line uint32) *wireguardSection {
|
||||
for index := range p.Sections {
|
||||
section := p.Sections[len(p.Sections)-index-1]
|
||||
|
||||
slices.Reverse(sections)
|
||||
|
||||
for _, section := range sections {
|
||||
if section.StartLine <= line && section.Name != nil {
|
||||
return §ion
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user