feat: new diagnostic DeprecatedHttpConnectionMethod - #4399
Conversation
Detects deprecated HTTPConnection methods in 1C:Enterprise 8.3.21+. Uses TypeService to resolve owner type — fires only when method is called on HTTPConnection object, eliminating false positives on generic names like Get/Write/Delete. Deprecated methods: CallHTTPMethod, Write, Change, SendForProcessing, Get, GetHeaders, Delete (and Russian equivalents). - Type: CODE_SMELL, Severity: MAJOR, minutesToFix: 5 - Compatibility mode: 8.3.21 - Tags: DEPRECATED, PERFORMANCE - Uses AbstractVisitorDiagnostic + TypeService owner resolution
📝 WalkthroughWalkthroughAdds a diagnostic for deprecated client-context ChangesDeprecated HTTP connection methods
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant BSLParser.MethodCallContext
participant DeprecatedHttpConnectionMethodDiagnostic
participant TypeService
participant DiagnosticStorage
BSLParser.MethodCallContext->>DeprecatedHttpConnectionMethodDiagnostic: visitMethodCall
DeprecatedHttpConnectionMethodDiagnostic->>TypeService: resolve called member type
TypeService-->>DeprecatedHttpConnectionMethodDiagnostic: return owner type
DeprecatedHttpConnectionMethodDiagnostic->>DiagnosticStorage: record matching deprecated call
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java (2)
48-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the public diagnostic contract.
Add JavaDoc for the public diagnostic class and its overridden visitor method. Describe the supported method names, the
HTTPConnectionowner invariant, and the diagnostic side effect.As per coding guidelines, “Javadoc классов и методов должен описывать контракт: параметры, результат, инварианты и побочные эффекты”.
Also applies to: 70-96
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java` at line 48, Add Javadoc to DeprecatedHttpConnectionMethodDiagnostic and its overridden visitor method, documenting supported method names, the requirement that the owner is HTTPConnection, and the diagnostic side effect; include parameter, result, invariant, and side-effect details required by the project guidelines.Source: Coding guidelines
64-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse Lombok for constructor injection.
Replace the handwritten constructor with
@RequiredArgsConstructor. The finaltypeServicefield already defines the constructor contract.As per coding guidelines, “use Lombok annotations to reduce boilerplate code”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java` around lines 64 - 68, Replace the handwritten constructor in DeprecatedHttpConnectionMethodDiagnostic with Lombok’s `@RequiredArgsConstructor`, retaining the final typeService field so Lombok generates the same constructor injection contract. Add the required annotation/import and remove only the redundant constructor.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java`:
- Around line 71-96: Update visitMethodCall in
DeprecatedHttpConnectionMethodDiagnostic so every early exit and the final
return delegates to super.visitMethodCall(ctx) instead of returning ctx, while
preserving the existing diagnostic checks and recording behavior.
In
`@src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnosticTest.java`:
- Around line 39-47: Add parameterized positive tests alongside
testOnArrayDoesNotFire for supported Russian and English HTTPConnection method
names, asserting both the diagnostic range and message. Reuse the existing
diagnostic setup and expected-value conventions, while preserving the current
non-HTTP Array negative case.
---
Nitpick comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java`:
- Line 48: Add Javadoc to DeprecatedHttpConnectionMethodDiagnostic and its
overridden visitor method, documenting supported method names, the requirement
that the owner is HTTPConnection, and the diagnostic side effect; include
parameter, result, invariant, and side-effect details required by the project
guidelines.
- Around line 64-68: Replace the handwritten constructor in
DeprecatedHttpConnectionMethodDiagnostic with Lombok’s `@RequiredArgsConstructor`,
retaining the final typeService field so Lombok generates the same constructor
injection contract. Add the required annotation/import and remove only the
redundant constructor.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 355b95bd-e02e-4f86-8e60-db53c2a5e19d
⛔ Files ignored due to path filters (1)
src/test/resources/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.bslis excluded by!src/test/resources/**
📒 Files selected for processing (6)
docs/diagnostics/DeprecatedHttpConnectionMethod.mddocs/en/diagnostics/DeprecatedHttpConnectionMethod.mdsrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.javasrc/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic_en.propertiessrc/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic_ru.propertiessrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnosticTest.java
| public ParseTree visitMethodCall(BSLParser.MethodCallContext ctx) { | ||
| var methodName = ctx.methodName(); | ||
| if (methodName == null) { | ||
| return ctx; | ||
| } | ||
|
|
||
| if (!MESSAGE_PATTERN.matcher(methodName.getText()).matches()) { | ||
| return ctx; | ||
| } | ||
|
|
||
| var identifier = methodName.IDENTIFIER(); | ||
| if (identifier == null) { | ||
| return ctx; | ||
| } | ||
|
|
||
| var typedMember = typeService.memberAt(documentContext, identifier); | ||
| if (typedMember.isEmpty()) { | ||
| return ctx; | ||
| } | ||
|
|
||
| var owner = typedMember.get().owner(); | ||
| if (owner != null && HTTP_CONNECTION_PATTERN.matcher(owner.qualifiedName()).matches()) { | ||
| diagnosticStorage.addDiagnostic(methodName, info.getMessage(methodName.getText())); | ||
| } | ||
|
|
||
| return ctx; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Continue traversal after handling the current call.
Each return ctx stops the visitor at this method-call subtree. Nested deprecated calls in arguments or chained expressions are not inspected. Return super.visitMethodCall(ctx) on lines 74, 78, 83, 88, and 96.
Proposed fix
- return ctx;
+ return super.visitMethodCall(ctx);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public ParseTree visitMethodCall(BSLParser.MethodCallContext ctx) { | |
| var methodName = ctx.methodName(); | |
| if (methodName == null) { | |
| return ctx; | |
| } | |
| if (!MESSAGE_PATTERN.matcher(methodName.getText()).matches()) { | |
| return ctx; | |
| } | |
| var identifier = methodName.IDENTIFIER(); | |
| if (identifier == null) { | |
| return ctx; | |
| } | |
| var typedMember = typeService.memberAt(documentContext, identifier); | |
| if (typedMember.isEmpty()) { | |
| return ctx; | |
| } | |
| var owner = typedMember.get().owner(); | |
| if (owner != null && HTTP_CONNECTION_PATTERN.matcher(owner.qualifiedName()).matches()) { | |
| diagnosticStorage.addDiagnostic(methodName, info.getMessage(methodName.getText())); | |
| } | |
| return ctx; | |
| public ParseTree visitMethodCall(BSLParser.MethodCallContext ctx) { | |
| var methodName = ctx.methodName(); | |
| if (methodName == null) { | |
| return super.visitMethodCall(ctx); | |
| } | |
| if (!MESSAGE_PATTERN.matcher(methodName.getText()).matches()) { | |
| return super.visitMethodCall(ctx); | |
| } | |
| var identifier = methodName.IDENTIFIER(); | |
| if (identifier == null) { | |
| return super.visitMethodCall(ctx); | |
| } | |
| var typedMember = typeService.memberAt(documentContext, identifier); | |
| if (typedMember.isEmpty()) { | |
| return super.visitMethodCall(ctx); | |
| } | |
| var owner = typedMember.get().owner(); | |
| if (owner != null && HTTP_CONNECTION_PATTERN.matcher(owner.qualifiedName()).matches()) { | |
| diagnosticStorage.addDiagnostic(methodName, info.getMessage(methodName.getText())); | |
| } | |
| return super.visitMethodCall(ctx); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java`
around lines 71 - 96, Update visitMethodCall in
DeprecatedHttpConnectionMethodDiagnostic so every early exit and the final
return delegates to super.visitMethodCall(ctx) instead of returning ctx, while
preserving the existing diagnostic checks and recording behavior.
| @Test | ||
| void testOnArrayDoesNotFire() { | ||
| // Проверяем что на Массиве не срабатывает (owner не HTTPСоединение) | ||
| initServerContext(TestUtils.PATH_TO_METADATA); | ||
| List<Diagnostic> diagnostics = getDiagnostics(); | ||
|
|
||
| // Массив.Получить и Массив.Удалить совпадают по имени, | ||
| // но владелец — Массив, не HTTPСоединение → не срабатывает | ||
| assertThat(diagnostics).isEmpty(); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add positive diagnostic cases.
This test only verifies that diagnostics are absent for an Array method. It does not verify that a supported HTTPConnection method produces a diagnostic.
Add parameterized positive cases for the supported Russian and English method names. Assert the diagnostic range and message. Keep this non-HTTP owner case.
As per coding guidelines, “Write comprehensive unit tests for each diagnostic including test cases for edge cases”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnosticTest.java`
around lines 39 - 47, Add parameterized positive tests alongside
testOnArrayDoesNotFire for supported Russian and English HTTPConnection method
names, asserting both the diagnostic range and message. Reuse the existing
diagnostic setup and expected-value conventions, while preserving the current
non-HTTP Array negative case.
Source: Coding guidelines
…uctor - Add class-level JavaDoc describing diagnostic contract and TypeService integration - Replace handwritten constructor with Lombok @requiredargsconstructor - Update fixture to demonstrate actual HTTPConnection code (not just Array)
|
Я не уверен что реализовывать в лоб хорошая идея, |
Async HTTP methods are only available on the client. The diagnostic
would produce false positives on server modules where sync methods
are the only option.
Add modules = {FormModule, CommandModule, OrdinaryApplicationModule, ManagedApplicationModule}
to DiagnosticMetadata annotation.
| severity = DiagnosticSeverity.MAJOR, | ||
| scope = DiagnosticScope.BSL, | ||
| modules = { | ||
| ModuleType.FormModule, |
There was a problem hiding this comment.
Форма может быть как НаКлиенте так и НаСервере, строго говоря ограничение по типу модуля наверное некорректно, а вывод доступности по видам доступности (Клиент\Сервер\etc) у нас я так понимаю ещё недоделан, возможно имеет смысл диагностику припарковать до момента когда появится понятный способ узнать что конкретная строка кода выполняется\может выполнятся именно на клиенте.
/cc @nixel2007
There was a problem hiding this comment.
У MethodSymbol есть CompilerDirectiveKind, можно по нему фильтровать
…r directive Async HTTP methods are client-only. Filter by two layers: 1. Module type (visitFile): skip server-only modules, check CommonModule client flags via mdObject 2. Compiler directive (visitSub): skip methods with &НаСервере / &НаСервереБезКонтекста directives Follows UsingSynchronousCallsDiagnostic pattern. Tests cover: - Array owner does not fire - Server module does not fire - Client directive fires, server directives do not (mocked TypeService)
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java`:
- Around line 149-164: Update isServerCommonModule to handle an empty
documentContext.getMdObject() safely: preserve the existing client-capability
check when CommonModule metadata exists, but return false when metadata is
missing so open common modules are not classified as strictly server-only. Add
regression coverage for a CommonModule with absent metadata and ensure
client-call checking still runs.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9573a464-f52b-48fe-ba2c-4dddd3bf5c34
⛔ Files ignored due to path filters (1)
src/test/resources/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.bslis excluded by!src/test/resources/**
📒 Files selected for processing (4)
docs/diagnostics/DeprecatedHttpConnectionMethod.mddocs/en/diagnostics/DeprecatedHttpConnectionMethod.mdsrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnosticTest.java
🚧 Files skipped from review as they are similar to previous changes (2)
- docs/diagnostics/DeprecatedHttpConnectionMethod.md
- docs/en/diagnostics/DeprecatedHttpConnectionMethod.md
| private static boolean isServerModule(DocumentContext documentContext) { | ||
| return switch (documentContext.getModuleType()) { | ||
| case ApplicationModule, CommandModule, FormModule, ManagedApplicationModule -> false; | ||
| case CommonModule -> isServerCommonModule(documentContext); | ||
| default -> true; // Все прочие модули — строго серверные | ||
| }; | ||
| } | ||
|
|
||
| private static boolean isServerCommonModule(DocumentContext documentContext) { | ||
| var mdObject = documentContext.getMdObject(); | ||
|
|
||
| return mdObject.map(CommonModule.class::cast) | ||
| .filter(commonModule -> !(commonModule.isClientManagedApplication() | ||
| || commonModule.isClientOrdinaryApplication())) | ||
| .isPresent(); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 6 \
'getMdObject\(\)|ModuleType\.CommonModule|isClientManagedApplication|isClientOrdinaryApplication' \
src/main/java src/test/javaRepository: 1c-syntax/bsl-language-server
Length of output: 50386
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the diagnostic implementation and targeted tests.
sed -n '1,230p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java
printf '\n--- target tests ---\n'
fd -i 'DeprecatedHttpConnectionMethod.*Test\.java$' src/test/java -x sh -c 'echo "### $1"; sed -n "1,220p" "$1"' sh {}
# Inspect DocumentContext.getMdObject implementation(s) and CommonModule capability methods.
rg -n 'class DocumentContext|interface DocumentContext|Optional<MD> getMdObject|getMdObject\(' src/main/java/src/test/java 2>/dev/null || rg -n 'getMdObject|class DocumentContext|MdObject' src/main/java src/test/java --glob '*.java' | head -n 200
printf '\n--- CommonModule api declarations usages ---\n'
rg -n 'class CommonModule|interface CommonModule|isClientManagedApplication|isClientOrdinaryApplication|defaultModule|ModuleType\.(CommonModule|CommandModule|FormModule)' src/main/java --glob '*.java' | head -n 250
# Behavioral Java Optional probe if javac/javadoc is unavailable is not needed; use source and tests.Repository: 1c-syntax/bsl-language-server
Length of output: 42262
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- DocumentContext.mdObject implementation ---\n'
sed -n '130,305p' src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
printf '\n--- computeMdObject ---\n'
sed -n '430,475p' src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
printf '\n--- DocumentContextTest relevant helpers ---\n'
sed -n '1,160p' src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java
printf '\n--- AbstractCommonModuleNameDiagnostic logic ---\n'
sed -n '1,125p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractCommonModuleNameDiagnostic.javaRepository: 1c-syntax/bsl-language-server
Length of output: 258
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- DocumentContext.mdObject implementation ---'
sed -n '130,305p' src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
printf '%s\n' ''
printf '%s\n' '--- computeMdObject ---'
sed -n '430,475p' src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
printf '%s\n' ''
printf '%s\n' '--- DocumentContextTest relevant helpers ---'
sed -n '1,160p' src test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java
printf '%s\n' ''
printf '%s\n' '--- AbstractCommonModuleNameDiagnostic logic ---'
sed -n '1,125p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractCommonModuleNameDiagnostic.javaRepository: 1c-syntax/bsl-language-server
Length of output: 7886
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- DocumentContextTest relevant helpers ---'
sed -n '1,160p' src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java
printf '%s\n' ''
printf '%s\n' '--- AbstractCommonModuleNameDiagnostic logic ---'
sed -n '1,125p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractCommonModuleNameDiagnostic.java
printf '%s\n' ''
printf '%s\n' '--- findChild declarations/usages ---'
rg -n -C 5 'findChild|ConfigurationModule|findChildBy|findDocumentDocument|findDocument|getConfiguration\(' src/main/java --glob '*.java' | head -n 220Repository: 1c-syntax/bsl-language-server
Length of output: 38408
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- Configuration findChild definitions ---'
rg -n -C 8 'interface Configuration|class .*Configuration|findChild|getModuleTypeByURI' src/main/java --glob '*.java' | sed -n '1,260p'
printf '%s\n' ''
printf '%s\n' '--- getModuleTypeByURI implementations/usages nearby ---'
rg -n -C 5 'getModuleTypeByURI' src/main/java --glob '*.java' | sed -n '1,260p'Repository: 1c-syntax/bsl-language-server
Length of output: 36574
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- exact findChild/getModuleTypeByURI signatures/classes ---'
rg -n 'interface Configuration|class Abstract.*Configuration|class .*Configuration.*extends|Class<.*Configuration>|findChild\(URI|findChild\(MdoRef|findChild\(' src/main/java --glob '*.java' | head -n 120
printf '%s\n' ''
printf '%s\n' '--- computeConfiguration definitions/classes ---'
rg -n -C 6 'computeConfiguration|getModuleTypeByURI|getChildrenByMdoRef|getModuleTypeFor|ModuleTypeFor|MdoRefMap|mappings' src/main/java --glob '*.java' | head -n 300Repository: 1c-syntax/bsl-language-server
Length of output: 27369
🌐 Web query:
GitHub com.github._1c_syntax bsl-language-server Configuration getModuleTypeByURI findChild
💡 Result:
In the bsl-language-server project, getModuleTypeByURI and findChild are distinct methods used within different parts of the codebase, primarily related to document context management and type resolution [1][2][3][4]. getModuleTypeByURI This method is primarily associated with resolving the type of a module (e.g., OScriptClass or OScriptModule) based on a document's URI [1][2]. It is notably used within the GlobalScopeProvider and as a fallback mechanism in DocumentContext to identify the module type when standard resolution is insufficient [1][3]. findChild In the context of bsl-language-server, findChild is an internal method used for looking up metadata objects (MD-objects) within the project's configuration structure based on a document's URI [4][5]. Specifically, it is implemented in DocumentContext (often via computeMdObject) to resolve an MD-object for a document [4][5]. Performance optimizations have been applied to this method—such as caching the result via a Lazy wrapper—because it is frequently called during indexing and reference resolution processes [4][5]. It is important to note that findChild is a common naming convention in many programming APIs (such as BeautifulSoup or Figma) [6][7], but in this specific GitHub repository, it refers to the server's internal logic for navigating the 1C configuration hierarchy [4][5].
Citations:
- 1: https://1c-syntax.github.io/bsl-language-server/javadoc/com/github/_1c_syntax/bsl/languageserver/context/OScriptModuleTypeResolver.html
- 2: https://1c-syntax.github.io/bsl-language-server/dev/javadoc/com/github/_1c_syntax/bsl/languageserver/types/oscript/OScriptModuleTypeResolver.html
- 3: https://1c-syntax.github.io/bsl-language-server/javadoc/com/github/_1c_syntax/bsl/languageserver/types/registry/GlobalScopeProvider.html
- 4: perf(context): кэшировать MD-объект и mdoRef документа (lazy) #4180
- 5: 30b6834
- 6: https://tedboy.github.io/bs4_doc/generated/generated/bs4.Tag.findChild.html
- 7: https://developers.figma.com/docs/plugins/api/properties/DocumentNode-findchild/
🌐 Web query:
site:github.com/1c-syntax/bsl-language-server "getModuleTypeByURI" ".getModuleTypeByURI" "Configuration"
💡 Result:
The term getModuleTypeByURI refers to an internal method used primarily within the context of the bsl-language-server, a language server project for BSL (1C:Enterprise) and OneScript development [1][2]. While it is not a public-facing configuration option, the method is used internally by the language server's type system and inference engines to determine the module type (such as BSL or OScript) of a document based on its URI [1][2]. Historically, this logic involved analyzing file extensions or paths to map a document to a specific ModuleType, which then influenced how the server provided features like autocompletion, type checking, and member lookup [1]. Recent architectural refactors in the bsl-language-server have evolved how type and module information is handled [3][2]. Modern implementations often rely on centralized services like TypeService or direct interactions with a TypeRegistry, moving away from explicit manual module type resolution where possible [3][2]. In many parts of the codebase, explicit references to ModuleType have been deprecated or reduced in favor of more dynamic or configuration-aware approaches [4][5][6]. In summary, getModuleTypeByURI is an internal programmatic helper method rather than a user-configurable setting. If you are encountering it, it is likely within the source code or debug logs of the language server, where it serves to identify the language context of the current file being processed [1][2].
Citations:
- 1: Feature/os class module type #3113
- 2: refactor(types): глобальная область видимости — члены синтетического типа ГлобальныйКонтекст #4135
- 3: feat(types): type system v2 — model, registry, inferencer, TypeService #3906
- 4: 9963843
- 5: d126165
- 6: 7ac4308
Handle missing common-module metadata before classifying client capability.
DocumentContext.getMdObject() comes from Configuration.findChild(getUri()) and can be empty for an open module without associated metadata. In that case, filter(...).isPresent() treats a client common module as strict server code and visitFile() skips it before client calls are checked. Use map(CommonModule.class::cast).map(common -> ...).orElse(true) or document why empty metadata is impossible for ModuleType.CommonModule, then add regression coverage for missing metadata.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedHttpConnectionMethodDiagnostic.java`
around lines 149 - 164, Update isServerCommonModule to handle an empty
documentContext.getMdObject() safely: preserve the existing client-capability
check when CommonModule metadata exists, but return false when metadata is
missing so open common modules are not classified as strictly server-only. Add
regression coverage for a CommonModule with absent metadata and ensure
client-call checking still runs.
Описание
Новая диагностика DeprecatedHttpConnectionMethod — находит вызовы устаревших методов объекта
HTTPСоединение(платформа 8.3.21+).Вместо синхронных методов следует использовать асинхронные аналоги с суффиксом
Асинх/Async.Closes #1934
Устаревшие методы
ВызватьHTTPМетод()/CallHTTPMethod()ВызватьHTTPМетодАсинх()Записать()/Write()ЗаписатьАсинх()Изменить()/Change()ИзменитьАсинх()ОтправитьДляОбработки()/SendForProcessing()ОтправитьДляОбработкиАсинх()Получить()/Get()ПолучитьАсинх()ПолучитьЗаголовки()/GetHeaders()ПолучитьЗаголовкиАсинх()Удалить()/Delete()УдалитьАсинх()Метаданные
Как работает (без FP!)
AbstractVisitorDiagnosticобходит все вызовы методов (visitMethodCall)TypeService.memberAt()резолвит тип-владелец методаHTTPСоединение/HTTPConnectionЭто исключает ложные срабатывания на
Получить()уМассива,Структурыи т.д.Состав PR
TypeService-резолвингом_ru.properties/_en.propertiesЧеклист
TypeService.memberAt()корректно фильтрует по типу владельцаSummary by CodeRabbit
New Features
Documentation
Tests