Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Highlighting: Terraform - Not getting full highlights #2220

Open
bryphe opened this issue Aug 3, 2020 · 2 comments
Open

Syntax Highlighting: Terraform - Not getting full highlights #2220

bryphe opened this issue Aug 3, 2020 · 2 comments
Labels
A-language-support Area: Language support, syntax highlighting, language server etc. A-syntax-highlighting Area: Syntax Highlighting bug Something isn't working L-terraform Language: terraform / HCL

Comments

@bryphe
Copy link
Member

bryphe commented Aug 3, 2020

Plugin: https://github.com/hashicorp/vscode-terraform (downloaded from: https://github.com/hashicorp/vscode-terraform/releases/download/v2.1.1/terraform-2.1.1.vsix)

Example file: https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/alexa/main.tf

Some syntax highlights are not present in Onivim for this syntax / theme pair -
VSCode:
image

Onivim:
image

Need to investigate and see if it's a problem with our handling of the textmate grammar - or if it is a problem with theme matching

@bryphe bryphe added bug Something isn't working A-language-support Area: Language support, syntax highlighting, language server etc. A-syntax-highlighting Area: Syntax Highlighting labels Aug 3, 2020
@LeonT-A
Copy link

LeonT-A commented Aug 11, 2020

Just ran into this myself and see that it's already mentioned. Thanks for your effort!

Extension: Ayu Dark Lighter

VSCode

Oni

Same thing with every Ayu variant I've tried, excpet for Ayu Dark Meta, which displays at it should.

@fabriziosestito
Copy link

+1 I ran into this problem with certain themes and elixir-ls

E.g. Nord theme arcticicestudio.nord-visual-studio-code

VSCode:
image

Oni:
image

Notice how the module name are in the standard foreground color.
Note: I am using a bracket pair colorizer in VSCode but not in Oni

@bryphe bryphe added the L-terraform Language: terraform / HCL label Jan 15, 2021
bryphe added a commit that referenced this issue Jan 15, 2021
…uest call (#2995)

__Issue:__ The terraform extension was failing with an error:

> Error: Activating 'hashicorp terraform' failed: The "listener" argument must be of type function. Received an instance of Object

__Defect:__ The extension was crashing here:
```
	https.request(url, options, res => {
			if (res.statusCode === 301 || res.statusCode === 302) { // follow redirects
				return resolve(httpsRequest(res.headers.location, options, encoding));
			}
```
when trying to resolve download locations for terraform releases. This was not specific to this plugin, but actually could crash in any 3-param call to `https.request`. (There are two overloads - a `https.request(options, cb)`, and `https.request(url, options.cb)`.

Because of the `agent-base` dependency that is brought in the node environment, it overwrites the `https.request` handler such that only the 2-param overload is accepted. More info here: microsoft/vscode#93167

__Fix:__ Update the `proxyResolver` code to only use the 2-param overload in our node environment, which the extension host is running in - onivim/vscode-exthost#30 . Add some test cases to ensure that both overloads can make requests

With this fix, as the language server now gets installed, get some basic language features (diagnostics, some completion, and outline) for terraform files:
![image](https://user-images.githubusercontent.com/13532591/104756239-6b867800-5710-11eb-8aff-cfd082ce0f1b.png)

Fixes #2981 
Related #1058 

Note that there is still a pending issue relating to the syntax highlights for terraform: #2220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Language support, syntax highlighting, language server etc. A-syntax-highlighting Area: Syntax Highlighting bug Something isn't working L-terraform Language: terraform / HCL
Projects
None yet
Development

No branches or pull requests

3 participants