Giter Site home page Giter Site logo

tim-koehler / helm-intellisense Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 22.0 2.83 MB

Extension for Visual Studio Code - Intellisense in helm-templates from the values.yaml

Home Page: https://marketplace.visualstudio.com/items?itemName=Tim-Koehler.helm-intellisense&ssr=false#overview

License: MIT License

TypeScript 96.86% Mustache 3.14%
autocomplete helm helm-intellisense helm-templates intellisense kubernetes vscode vscode-extension

helm-intellisense's Introduction

Hey, I'm Tim, a selfemployed software engineer from Germany.

About me: Tims github stats

  • ๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป Bachelors degree in Computer-Science at HTWG in Konstanz(Germany)
  • ๐Ÿ”ง Currently working for various customers, mainly as DevOps and Backend engineer.
  • ๐Ÿ’ฌ Right now my favourite language is GO
  • โœ๏ธ Feel free to contribute to my projects
  • โ“ Ask me about anything, I am happy to help

Languages and Tools:

helm-intellisense's People

Contributors

andischerer avatar dependabot[bot] avatar marcfrederick avatar tim-koehler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

helm-intellisense's Issues

helm-intellisense: lint file giving illegal argument error

Full logs:
2024-04-08 23:21:29.800 [error] Error: Illegal argument: character must be non-negative
at p (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:10:1029)
at new g (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:152:4728)
at L1 (/root/.vscode-server/extensions/tim-koehler.helm-intellisense-0.14.3/out/extension.js:53:394)
at mi (/root/.vscode-server/extensions/tim-koehler.helm-intellisense-0.14.3/out/extension.js:51:10299)
at /root/.vscode-server/extensions/tim-koehler.helm-intellisense-0.14.3/out/extension.js:53:3883
at d.h (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:154:186874)
at d.$executeContributedCommand (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:154:187734)
at h.S (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:151:5502)
at h.Q (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:151:5268)
at h.M (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:151:4361)
at h.L (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:151:3440)
at a.value (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:151:2227)
at s.y (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:659)
at s.fire (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:876)
at r.fire (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:14173)
at a.value (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:177:8018)
at s.y (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:659)
at s.fire (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:876)
at r.fire (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:14173)
at d.z (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:17238)
at a.value (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:15690)
at s.y (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:659)
at s.fire (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:82:876)
at g.acceptChunk (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:11947)
at /root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:107:11234
at Socket.k (/root/.vscode-server/cli/servers/Stable-5c3e652f63e798a5ac2f31ffd0d863669328dc4c/server/out/vs/workbench/api/node/extensionHostProcess.js:174:13162)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
at readableAddChunk (node:internal/streams/readable:308:9)
at Socket.Readable.push (node:internal/streams/readable:245:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) extension.Lint {"value":"Tim-Koehler.helm-intellisense","_lower":"tim-koehler.helm-intellisense"}

VSCode running on ubuntu 20.04 via remote ssh:
Version: 1.88.0 (user setup)
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:26:18.741Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631

Helm Dependency Linting

Would it be possible to have dependencies be linted for their .tpl's so that when I use my Templates variables, it doesn't show an error.

Library Chart support?

Plugin shows "Template not found" when using Library Charts. Are they not supported?

e.g.

{{- include "library.deployment" (list . "local.deployment") -}}

puts red squiggly line under library.deployment with "Template not definedHelm-Intellisense"

Don't show array indices as keys

Currently when accessing an array value, indices will be suggested as keys. A value defined as {"foo": ["bar", "baz"]} will lead to 0 and 1 being suggested after entering .Values.foo..

Ignore `README.md.gotmpl`

Thank you very much for this extension, it has already helped out with several bugs so far ๐Ÿ˜„

I just have a small issue for now: when using helm-docs, you often write a README.md.gotmpl next to a chart README.md.
This file can look something like this:

{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.valuesSection" . }}

Each of the templates are catched with the message Template not defined.
Would it be possible to ignore specific files such as these?

lint on save not working and autocomplete bug

Hi, @tim-koehler
lint does not work when saving (no info in output), but if you run the helm intellisense: lint chart command, everything works.
Also auto-completion does not work if helm-intellisense.customValueFileNames are specified

vscode:

Version: 1.60.2 (Universal)
Commit: 7f6ab5485bbc008386c4386d08766667e155244e
Date: 2021-09-22T11:59:27.195Z (2 wks ago)
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 20.6.0

macbook: MacBook Pro (13-inch, M1, 2020)
macos: 11.6 (20G165)

PS: thanks for the great extension - best for DevOps

Add support for comments

VSCode supports modifying how comments are applied. It would be nice if this added support for automatically toggling {{/* */}}.

Is this repo still alive?

Missing value at path for something that is nested in an if statement

We are using a chart that has a lot of values that will only be put into the output of helm if the value path exists. Example:

      {{- if .Values.image.pullSecret }}
      imagePullSecrets:
        - name: {{ .Values.image.pullSecret }}
      {{- end }}

But when I lint this it tells me that "Missing value at path [.Values.image.pullSecret]" for the 3rd line. Even putting a default value in for it doesn't stop the lint error. Thoughts on making the linter ok with the value path being called in an if statement?

Add Windows support

Hey There,

thanks for this beautiful extension.
It looks like this extension is not working on windows machines because of some hardcoded fs path magic('/').

I will create a pr if you are willing to support the windows platform.

`define`s Not Found When They're In Other Files

Hi! Very nice plugin!

One issue I'm running into is the plugin being able to find define blocks from other YAML files. For example, let's say I have two files:

  1. A file called _ports.yaml where I define port constants that are used across the chart, like {{- define "my.port" -}}.
  2. A file called stateful-set.yaml, which uses {{ include "my.port" }} to get the port value from _ports.yaml.

The practice is a bit unusual, but it works perfectly well in Helm and passes Helm linting checks. As such, I believe it should work this plugin.

Looking forward to further thoughts on this use-case.

Enhancement proposal - Show actual resolved values

Hi,

Great plugin, really helps out in writing templates.
Would it be possible to show the actual value from Values.yaml?

example:
{{ .Values.global.services.docker_registry_port }}

to show the actual port number in some form, preferred way would be in the intellisense pop-up or maybe right click?

Thanks,
Tal

Runs on projects if there is a parent directory called "templates"

Problem

I have a project in a path which includes templates in the directory chain. On every save, I get a could not locate any values.yaml error.

Reproduction Steps

$ mkdir -p /tmp/templates/foo
$ code /tmp/templates/foo
# create a README.md and save, you should get an error
$ mkdir -p /tmp/bar
$ code /tmp/bar
# create a README.md and save, you should NOT get an error

Screenshot

Screen Shot 2021-02-22 at 3 21 48 PM

Tests failing

There are currently some test failures. Seems like either the expected values or the tested chart have changed since the introduction of those tests.

  1) Test Utils
       getValuesFromFile:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ '{"replicaCount":1,"foo":{"bar":"baz","baz":["foo","bar","baz"]},"image":{"repository":"nginx","tag":"stable","pullPolicy":"IfNotPresent"},"imagePullSecrets":[],"nameOverride":"","fullnameOverride":"","serviceAccount":{"create":true,"name":null},"podSecurityContext":{},"securityContext":{},"service":{"type":"ClusterIP","port":80},"ingress":{"enabled":false,"annotations":{},"hosts":[{"host":"chart-example.local","paths":[]}],"tls":[]},"resources":{},"nodeSelector":{},"tolerations":[],"affinity":{}}'
- '{"replicaCount":1,"foo":{"bar":"baz","baz":["foo","bar","baz"]},"image":{"repository":"nginx","tag":"stable","pullPolicy":"Always"},"imagePullSecrets":[],"nameOverride":"","fullnameOverride":"","serviceAccount":{"create":true,"name":null},"podSecurityContext":{},"securityContext":{},"service":{"type":"ClusterIP","port":80},"ingress":{"enabled":false,"annotations":{},"hosts":[{"host":"chart-example.local","paths":[]}],"tls":[]},"resources":{},"nodeSelector":{},"tolerations":[],"affinity":{}}'
      + expected - actual

      -{"replicaCount":1,"foo":{"bar":"baz","baz":["foo","bar","baz"]},"image":{"repository":"nginx","tag":"stable","pullPolicy":"IfNotPresent"},"imagePullSecrets":[],"nameOverride":"","fullnameOverride":"","serviceAccount":{"create":true,"name":null},"podSecurityContext":{},"securityContext":{},"service":{"type":"ClusterIP","port":80},"ingress":{"enabled":false,"annotations":{},"hosts":[{"host":"chart-example.local","paths":[]}],"tls":[]},"resources":{},"nodeSelector":{},"tolerations":[],"affinity":{}}
      +{"replicaCount":1,"foo":{"bar":"baz","baz":["foo","bar","baz"]},"image":{"repository":"nginx","tag":"stable","pullPolicy":"Always"},"imagePullSecrets":[],"nameOverride":"","fullnameOverride":"","serviceAccount":{"create":true,"name":null},"podSecurityContext":{},"securityContext":{},"service":{"type":"ClusterIP","port":80},"ingress":{"enabled":false,"annotations":{},"hosts":[{"host":"chart-example.local","paths":[]}],"tls":[]},"resources":{},"nodeSelector":{},"tolerations":[],"affinity":{}}
      
  	at Context.<anonymous> (out/test/suite/utils.test.js:50:16)
  	at processImmediate (internal/timers.js:461:21)
  	at process.callbackTrampoline (internal/async_hooks.js:131:14)

/Applications/Visual Studio Code.app/Contents/Resources/app/out/out-vscode/bootstrap-fork.js:166
  2) Test ValuesCompletionItemProvider
       provideCompletionItems() with `.Values.image.`:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ '[{"label":"repository","kind":"Field","detail":"nginx"},{"label":"tag","kind":"Field","detail":"stable"},{"label":"pullPolicy","kind":"Field","detail":"IfNotPresent"}]'
- '[{"label":"repository","kind":"Field","detail":"nginx"},{"label":"tag","kind":"Field","detail":"stable"},{"label":"pullPolicy","kind":"Field","detail":"Always"}]'
      + expected - actual

      -[{"label":"repository","kind":"Field","detail":"nginx"},{"label":"tag","kind":"Field","detail":"stable"},{"label":"pullPolicy","kind":"Field","detail":"IfNotPresent"}]
      +[{"label":"repository","kind":"Field","detail":"nginx"},{"label":"tag","kind":"Field","detail":"stable"},{"label":"pullPolicy","kind":"Field","detail":"Always"}]
      
  	at /Users/marcfrederick/src/Helm-Intellisense/out/test/suite/valuesCompletionItemProvider.test.js:36:16
  	at Generator.next (<anonymous>)
  	at fulfilled (out/test/suite/valuesCompletionItemProvider.test.js:5:58)

Awesome, but would be even better with links to implementation

Hi,

thank you very much for this awesome project I just stumbled on ๐Ÿฅณ

Do you think it would be possible to get backlinks from the reference to the "implementation"? The fact that you already know the files would suggest for me that the way should not be too far.

If you need support for that feature, maybe I could assist coding

Extension issue

  • Issue Type: Bug
  • Extension Name: helm-intellisense
  • Extension Version: 0.9.2
  • OS Version: Windows_NT x64 10.0.19041
  • VSCode version: 1.54.3

โš ๏ธ We have written the needed data into your clipboard. Please paste! โš ๏ธ

{
	"messages": [],
	"activationTimes": {
		"codeLoadingTime": 4080,
		"activateCallTime": 2,
		"activateResolvedTime": 3,
		"activationReason": {
			"startup": false,
			"extensionId": {
				"value": "Tim-Koehler.helm-intellisense",
				"_lower": "tim-koehler.helm-intellisense"
			},
			"activationEvent": "onStartupFinished"
		}
	},
	"runtimeErrors": []
}

auto completion is not fetching values from _helpers.tpl

auto completion is not working for values present in the _helpers.tpl.

_helpers.tpl

{{- define "nginx.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}


Example :
Completion from Pycharm Professional.

image

Missing value at path rule should be improved

First off... thanks for this idea/tool. I am currently testing, if it is helpfull. I noticed the following when usign it with my charts:

In this example you see the the tool is generating an error. This is indeed correct that .Values.externalServices.mysql is not existing, but at the same time it is my desire to have the default empty. That is the reason why im am testing for the value.

Futhermore I do not know what to recommend. I just wanted to let you know.

image

Folder level settings

I tried to put the following:

"helm-intellisense.customValueFileNames": [ "k8s_dev-stek-vrfs.yaml" ]

in the settings.json inside a project, but I get this message:
"This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly."

Is this a bug? How can I apply the customValueFileNames setting at the folder level, when using an workspace?

Output generated in the output tab moves cursor focus to the output tab.

So that's not the clearest title so I'll try to explain what I mean by that.

When typing a command, the intellisense all works correctly and as expected, however after typing .Values. (after typing the last dot), the intellisense appears as expected (and lists all of my available values), however after around a second, a message appears in the output:

Missing value at path [.Values.] in file [{PATH}\deployment.yaml:16]

Whilst this error appearing in the output isn't an issue exactly, it forces the focus from the window where I am typing to the output window making it very difficult to type anything.

Specify Hierarchy of Value Files

This is more of a question than an issue?

Hierarchy Support

Are there any plans to support specifying a hierarchy of value files. For example one representation could be:

customValueFileNames = [
  // default values
  "values.yaml",
  // staging-values which inherits from values
  ["staging-values.yaml", "values.yaml"],
  // production-values inherit from staging which inherit from values
  ["production-values.yaml", "staging-values.yaml", "values.yaml"],
]

At least in my current use case it seems quite handy to be able to check hierarchies of template values.

Checking All Values

I also noticed that customValueFileNames uses the first found value file. Are there any plans to check all specified value files, if found?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.