use of com.github._1c_syntax.bsl.languageserver.context.DocumentContext in project bsl-language-server by 1c-syntax.
the class QueryComputerTest method compute.
@Test
void compute() {
// given
DocumentContext documentContext = TestUtils.getDocumentContextFromFile("./src/test/resources/context/computer/QueryComputerTest.bsl");
// when
var queries = documentContext.getQueries();
// then
assertThat(queries).hasSize(10);
assertThat(queries.get(0).getTokens().get(1).getLine()).isEqualTo(3);
assertThat(queries.get(6).getTokens().get(2).getLine()).isEqualTo(30);
assertThat(queries.get(8).getTokens().get(1).getLine()).isEqualTo(45);
assertThat(queries.get(8).getTokens().get(31).getLine()).isEqualTo(50);
assertThat(queries.get(9).getTokens().get(9).getLine()).isEqualTo(59);
}
use of com.github._1c_syntax.bsl.languageserver.context.DocumentContext in project bsl-language-server by 1c-syntax.
the class CommonModuleNameFullAccessDiagnosticTest method getDocumentContextFromFile.
@SneakyThrows
void getDocumentContextFromFile() {
Path path = Absolute.path(PATH_TO_METADATA);
Path testFile = Paths.get(PATH_TO_MODULE_FILE).toAbsolutePath();
initServerContext(path);
var configuration = context.getConfiguration();
documentContext = spy(TestUtils.getDocumentContext(testFile.toUri(), FileUtils.readFileToString(testFile.toFile(), StandardCharsets.UTF_8), context));
module = spy((MDCommonModule) configuration.getModulesByObject().get(documentContext.getUri()));
}
use of com.github._1c_syntax.bsl.languageserver.context.DocumentContext in project bsl-language-server by 1c-syntax.
the class CommonModuleNameGlobalClientDiagnosticTest method getDocumentContextFromFile.
@SneakyThrows
void getDocumentContextFromFile() {
Path path = Absolute.path(PATH_TO_METADATA);
Path testFile = Paths.get(PATH_TO_MODULE_FILE).toAbsolutePath();
initServerContext(path);
var configuration = context.getConfiguration();
documentContext = spy(TestUtils.getDocumentContext(testFile.toUri(), FileUtils.readFileToString(testFile.toFile(), StandardCharsets.UTF_8), context));
module = spy((MDCommonModule) configuration.getModulesByObject().get(documentContext.getUri()));
}
use of com.github._1c_syntax.bsl.languageserver.context.DocumentContext in project bsl-language-server by 1c-syntax.
the class CommonModuleNameWordsDiagnosticTest method getDocumentContextFromFile.
@SneakyThrows
void getDocumentContextFromFile() {
Path path = Absolute.path(PATH_TO_METADATA);
Path testFile = Paths.get(PATH_TO_MODULE_FILE).toAbsolutePath();
initServerContext(path);
var configuration = context.getConfiguration();
documentContext = spy(TestUtils.getDocumentContext(testFile.toUri(), FileUtils.readFileToString(testFile.toFile(), StandardCharsets.UTF_8), context));
module = spy((MDCommonModule) configuration.getModulesByObject().get(documentContext.getUri()));
}
use of com.github._1c_syntax.bsl.languageserver.context.DocumentContext in project bsl-language-server by 1c-syntax.
the class CompilationDirectiveLostDiagnosticTest method testFormModule.
@Test
void testFormModule() {
DocumentContext documentContext = getDocumentContext();
List<Diagnostic> diagnostics = getDiagnostics(documentContext);
assertThat(diagnostics).hasSize(1);
assertThat(diagnostics, true).hasRange(9, 8, 9, 16);
}
Aggregations