fix(vipeye-internal): 恢复 py.typed 探测,修复 PartialStub 映射失效导致的 viperFileSystem 5 个失败
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
- pyTypedUtils: 去掉按方言短路(IsViperDialect 恒为 true 使探测恒返回 undefined) - partialStubService: 虚拟映射过滤器补回 .pyi(存根后缀支持 .vpi/.vpnci/.pyi) - launch.json: 调试宿主同时禁用已安装的 TermiNexus.vipeye(真实扩展 ID)
This commit is contained in:
1 parent
d5398ab4e2
commit
e4635eca37
4 files changed
+25
-20
No files matched your search
Vendored
+4
-2
@@ -41,7 +41,8 @@
|
||||
// / "Cannot register 'viper.xxx' ... already registered" 激活失败。
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode-vipeye",
|
||||
// 禁用已安装的发布版,避免与调试版同时加载冲突。
|
||||
"--disable-extension=TermiNexus.vscode-vipeye"
|
||||
"--disable-extension=TermiNexus.vscode-vipeye",
|
||||
"--disable-extension=TermiNexus.vipeye",
|
||||
],
|
||||
"smartStep": true,
|
||||
"sourceMaps": true,
|
||||
@@ -59,7 +60,8 @@
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode-vipeye",
|
||||
"--disable-extension=TermiNexus.vscode-vipeye",
|
||||
"--disable-extension=be5invis.vscode-custom-css",
|
||||
"--disable-extension=msgcenterext.msgcenter"
|
||||
"--disable-extension=msgcenterext.msgcenter",
|
||||
"--disable-extension=TermiNexus.vipeye",
|
||||
],
|
||||
"smartStep": true,
|
||||
"sourceMaps": true,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import { FileSystem } from '../common/fileSystem';
|
||||
import { IsViperDialect, LanguageDialect } from '../common/dialect';
|
||||
import { LanguageDialect } from '../common/dialect';
|
||||
import { Uri } from '../common/uri/uri';
|
||||
import { isDirectory, isFile } from '../common/uri/uriUtils';
|
||||
|
||||
@@ -20,16 +20,16 @@ export interface PyTypedInfo {
|
||||
//
|
||||
// Retrieves information about a py.typed file, if it exists, under the given path.
|
||||
//
|
||||
// 注:本模块只做纯文件系统探测,不做方言分支。Viper 工程同样需要该探测:
|
||||
// `foo-stubs/` 存根包(PEP 561 式布局)的虚拟映射(PartialStubService)依据
|
||||
// py.typed 的 `partial` 标记决定是否把存根合并进已安装目录;此前按方言短路
|
||||
// 会让映射永不生效(viperFileSystem 用例全部失败)。
|
||||
// dialect 参数保留是为了兼容既有调用点,当前实现不依赖它。
|
||||
export function getPyTypedInfo(
|
||||
fileSystem: FileSystem,
|
||||
dirPath: Uri,
|
||||
dialect?: LanguageDialect
|
||||
_dialect?: LanguageDialect
|
||||
): PyTypedInfo | undefined {
|
||||
// Viper 模式短路:Viper 无 PEP 561 py.typed 标记机制,跳过探测。
|
||||
if (IsViperDialect(dialect)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!fileSystem.existsSync(dirPath) || !isDirectory(fileSystem, dirPath)) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export function getPyTypedInfo(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getPyTypedInfoForPyTypedFile(fileSystem, pyTypedPath, dialect);
|
||||
return getPyTypedInfoForPyTypedFile(fileSystem, pyTypedPath, _dialect);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -48,13 +48,8 @@ export function getPyTypedInfo(
|
||||
export function getPyTypedInfoForPyTypedFile(
|
||||
fileSystem: FileSystem,
|
||||
pyTypedPath: Uri,
|
||||
dialect?: LanguageDialect
|
||||
_dialect?: LanguageDialect
|
||||
) {
|
||||
// Viper 模式短路:Viper 无 PEP 561 py.typed 标记机制,跳过解析。
|
||||
if (IsViperDialect(dialect)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// This function intentionally doesn't check whether the given py.typed path exists or not,
|
||||
// as filesystem access is expensive if done repeatedly.
|
||||
// The caller should verify the file's validity before calling this method and use a cache if possible
|
||||
|
||||
@@ -118,6 +118,9 @@ export class PartialStubService implements SupportPartialStubs {
|
||||
continue;
|
||||
}
|
||||
// Merge partial stub packages to the library.
|
||||
// 只映射存根文件(.vpi/.vpnci 为 Viper 存根,.pyi 为 Python 兼容回退,
|
||||
// 见 importResolver.supportedSourceFileExtensions)与目录;
|
||||
// 其它文件(如 py.typed 标记)不进入映射视图。
|
||||
this._movedDirectories.push(
|
||||
this._realFs.mapDirectory(
|
||||
packagePath,
|
||||
@@ -125,6 +128,7 @@ export class PartialStubService implements SupportPartialStubs {
|
||||
(u, fs) =>
|
||||
u.hasExtension('.vpi') ||
|
||||
u.hasExtension('.vpnci') ||
|
||||
u.hasExtension('.pyi') ||
|
||||
(fs.existsSync(u) && fs.statSync(u).isDirectory())
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import t, c
|
||||
import ast
|
||||
|
||||
class Holder:
|
||||
ch_r: list[ast.AST*]*
|
||||
direct: rawptr[ast.AST]
|
||||
def main() -> int:
|
||||
x: int = 42
|
||||
px: int | t.CPtr = &x
|
||||
*px = 100
|
||||
y: int = *px
|
||||
pz: int* = &x
|
||||
*pz = 7
|
||||
return 0
|
||||
Reference in new issue
Block a user