【问题标题】:VSCode extension - getting started with ksonnetVSCode 扩展 - ksonnet 入门
【发布时间】:2018-08-06 16:59:42
【问题描述】:

我真的很想尝试使用 VSCode 扩展的 ksonnet,但似乎无法正确设置,我已阅读设置说明。

我做了以下事情:

  • brew install ks
  • brew install jsonnet
  • ks init traefik
  • git clone https://github.com/ksonnet/ksonnet-lib.git
  • 编辑 vscode 设置并将ksonnet-lib 添加到设置中: "jsonnet.libPaths": ["/Users/kross/projects/gke/ksonnet-lib"],
  • 在新的 vscode 窗口中打开生成的 traefik 文件夹(不推荐,但想知道根路径的分辨率)

这是我看到的错误:

RUNTIME ERROR: couldn't open import "base.libsonnet": no match locally or in the Jsonnet library paths.
Can't find path 'base.libsonnet'. If the file is not in the current directory, it may be necessary to add it to the 'jsonnet.libPaths'. If you are in vscode, you can press 'cmd/ctrl-,' and add the path this library is located at to the 'jsonnet.libPaths' array

注意:预览窗格确实适用于 ks generate deployed-service 文件,但是 预览窗格不适用于 tutorial redis 实例(但 ks show default 确实有效):

Command failed: jsonnet -J /Users/kross/projects/gke/ksonnet-lib  --ext-code-file "__ksonnet/params"=/Users/kross/projects/gke/traefik/components/params.libsonnet --ext-code-file "__ksonnet/environments"=/Users/kross/projects/gke/traefik/environments/default/params.libsonnet /Users/kross/projects/gke/traefik/components/redis.jsonnet
RUNTIME ERROR: couldn't open import "k.libsonnet": no match locally or in the Jsonnet library paths.
/Users/kross/projects/gke/traefik/components/redis.jsonnet:4:11-31  thunk 
/Users/kross/projects/gke/traefik/components/redis.jsonnet:18:11    thunk 
std.jsonnet:1239:24 
std.jsonnet:1239:15-26  thunk 
std.jsonnet:1240:8  thunk 
std.jsonnet:1240:8-20   function 
std.jsonnet:1240:8-20   function 
/Users/kross/projects/gke/traefik/components/redis.jsonnet:(18:1)-(22:4)    

我一定遗漏了一些非常基本的东西——它是什么?

【问题讨论】:

标签: visual-studio-code jsonnet ksonnet


【解决方案1】:

我在使用 VScode JSONNET 扩展时遇到了类似的错误。见这里:https://github.com/heptio/vscode-jsonnet/issues/57

我可以通过在用户设置中修改扩展程序的设置来解决此问题:

"jsonnet.libPaths": [
    "<my-home-dir-full-path>/go/src/github.com/ksonnet/ksonnet-lib/ksonnet.beta.3"
],

另外,请注意,目前官方的 ksonnet VSCode 扩展正在由 ksonnet 团队开发。

【讨论】:

  • 谢谢,另外值得注意的是,如果在vscode中打开的根文件夹不是包含app.yml的文件夹(以ksonnet为例),则会出现错误。
  • 啊,太好了!希望 ksonnet 的扩展快点出来。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-11-21
  • 1970-01-01
  • 2018-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-22
相关资源
最近更新 更多