Skip to content

Commit

Permalink
Set remote to true for language server and added baseflag override
Browse files Browse the repository at this point in the history
the baseflagis set to the doc URI if it’s not set in the config, this will be the default out of the box.

Signed-off-by: quobix <dave@quobix.com>
  • Loading branch information
daveshanley committed Feb 9, 2024
1 parent e8ae7c1 commit 6ba5579
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/mitchellh/mapstructure v1.5.0
github.com/pb33f/doctor v0.0.4
github.com/pb33f/libopenapi v0.15.7
github.com/pb33f/libopenapi v0.15.8
github.com/pb33f/libopenapi-validator v0.0.42
github.com/pterm/pterm v0.12.78
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/pb33f/doctor v0.0.4 h1:+JVwBsVwwMR0Um13mODlQ/h/HpFpyNPKieQXk/sEf2c=
github.com/pb33f/doctor v0.0.4/go.mod h1:yBs5hFHAoo/eeFvKN9sWwmHmgEPJ2SaotYOJc05GdMU=
github.com/pb33f/libopenapi v0.15.7 h1:xdXodMBSYUmLYxEH2UxOCaeKrmBQEXO5XSaBbhQ6H3Q=
github.com/pb33f/libopenapi v0.15.7/go.mod h1:m+4Pwri31UvcnZjuP8M7TlbR906DXJmMvYsbis234xg=
github.com/pb33f/libopenapi v0.15.8 h1:HtUqEbpIdAn3QzwEA5suQpP73FzCY8CkQnF2oLrnTes=
github.com/pb33f/libopenapi v0.15.8/go.mod h1:m+4Pwri31UvcnZjuP8M7TlbR906DXJmMvYsbis234xg=
github.com/pb33f/libopenapi-validator v0.0.42 h1:bfwPWlxUFHtvPNi0PH+EVpQBU2kA3Db9rVdFkfmUVac=
github.com/pb33f/libopenapi-validator v0.0.42/go.mod h1:kU1JYyXIRlpmsWx3NkL+drNNttLADMgdaNzJgXDhec0=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
Expand Down
7 changes: 6 additions & 1 deletion language-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/tliron/glsp"
protocol "github.com/tliron/glsp/protocol_3_16"
glspserv "github.com/tliron/glsp/server"
"path/filepath"
"strings"
"time"
)
Expand Down Expand Up @@ -109,13 +110,17 @@ func (s *ServerState) runDiagnostic(doc *Document, notify glsp.NotifyFunc, delay
go func() {
var diagnostics []protocol.Diagnostic

if s.lintRequest.BaseFlag == "" {
s.lintRequest.BaseFlag = filepath.Dir(strings.TrimPrefix(doc.URI, "file://"))
}

result := motor.ApplyRulesToRuleSet(&motor.RuleSetExecution{
RuleSet: s.lintRequest.SelectedRS,
Timeout: time.Duration(s.lintRequest.TimeoutFlag) * time.Second,
CustomFunctions: s.lintRequest.Functions,
IgnoreCircularArrayRef: s.lintRequest.IgnoreArrayCircleRef,
IgnoreCircularPolymorphicRef: s.lintRequest.IgnorePolymorphCircleRef,
AllowLookup: s.lintRequest.Remote,
AllowLookup: true,
Base: s.lintRequest.BaseFlag,
Spec: []byte(doc.Content),
SkipDocumentCheck: s.lintRequest.SkipCheckFlag,
Expand Down

0 comments on commit 6ba5579

Please sign in to comment.