blob: 2eee5de68a43d2b8c47d23ec1bc200220c96d1f7 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package langserver
import (
"log"
"os"
"fidl-lsp/analysis"
"fidl-lsp/state"
)
type TestFile struct {
Name string
Text string
}
func NewHandlerWithFiles(files ...TestFile) *LangHandler {
handler := NewLangHandler(
NewDefaultConfig(),
log.New(os.Stderr, "[LSP Test] ", log.Lshortfile),
analysis.CompiledLibraries{},
)
for _, file := range files {
handler.fs.OpenFile(state.EditorFile(file.Name), file.Text)
handler.analyzer.Analyze(handler.fs, state.EditorFile(file.Name))
}
return handler
}