Gusti

Gusti

Hi,

I cannot get VS Code with the elixir-ls extension to format my code.
Only thru “mix format” command.

Environment:
Erlang/OTP 23 [erts-11.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.11.3 (compiled with Erlang/OTP 23)
elixir-lsp.elixir-ls-0.6.2

I even tried after recompiling elixirls with my current elixir installation.
I have configured VS Code settings.json, to specify ‘elixir-lsp.elixir-ls’ as the default formatter.

Any ideas what other things I need to tweak in order for it to work?

Best regards,
Gusti.

Showing Posts 1 to 9

axelson

axelson

Scenic Core Team

Hi :wave:! Are you running the “Format Command” in VSCode (defaults to alt+shift+f)?

If that isn’t working then try running through the debugging steps: GitHub - elixir-lsp/vscode-elixir-ls: Elixir language support and debugger for VS Code, powered by ElixirLS. · GitHub

Gusti

Gusti OP

I tried with keyboard secuences alt+shift+f.
I also tried with Ctrl+shift+p, then “Format document”

Nothing happens.

View output:

Started ElixirLS v0.6.2

Elixir version: “1.11.3 (compiled with Erlang/OTP 23)”

Erlang version: “23”

ElixirLS compiled with Elixir 1.8.2 and erlang 21

MIX_ENV: test

MIX_TARGET:

[Info - 12:40:35 PM] Compile took 550 milliseconds

[Info - 12:40:35 PM] [ElixirLS WorkspaceSymbols] Indexing…

The toggle developer tools output is:

electron/js2c/renderer_init.js:15 (electron) Security Warning: webFrame.executeJavaScript was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.
log @ electron/js2c/renderer_init.js:15
electron/js2c/renderer_init.js:135 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
Policy set or a policy with “unsafe-eval” enabled. This exposes users of
this app to unnecessary security risks.

For more information and help, consult
Security | Electron.
This warning will not show up
once the app is packaged.
(anonymous) @ electron/js2c/renderer_init.js:135
workbench.html:1 A cookie associated with a cross-site resource at https://open-vsx.org/ was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at Chrome Platform Status and Chrome Platform Status.
webviewElement.ts:90 [Embedded Page] %cElectron Security Warning (enableBlinkFeatures) font-weight: bold; This renderer process has additional “enableBlinkFeatures”
enabled. This exposes users of this app to some security risk. If you do not
need this feature, you should disable it.

For more information and help, consult
Security | Electron.
This warning will not show up
once the app is packaged.
webviewElement.ts:90 [Embedded Page] (electron) Security Warning: webFrame.executeJavaScript was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.
webviewElement.ts:90 [Embedded Page] %cElectron Security Warning (Insecure Content-Security-Policy) font-weight: bold; This renderer process has either no Content Security
Policy set or a policy with “unsafe-eval” enabled. This exposes users of
this app to unnecessary security risks.

For more information and help, consult
Security | Electron.
This warning will not show up
once the app is packaged.
webviewElement.ts:90 [Embedded Page] %cElectron Security Warning (enableBlinkFeatures) font-weight: bold; This renderer process has additional “enableBlinkFeatures”
enabled. This exposes users of this app to some security risk. If you do not
need this feature, you should disable it.

For more information and help, consult
Security | Electron.
This warning will not show up
once the app is packaged.
webviewElement.ts:90 [Embedded Page] (electron) Security Warning: webFrame.executeJavaScript was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.
webviewElement.ts:90 [Embedded Page] %cElectron Security Warning (Insecure Content-Security-Policy) font-weight: bold; This renderer process has either no Content Security
Policy set or a policy with “unsafe-eval” enabled. This exposes users of
this app to unnecessary security risks.

For more information and help, consult
Security | Electron.
This warning will not show up
once the app is packaged.
log.ts:191 WARN Settings pattern “workbench.fontAliasing” doesn’t match any settings
log.ts:191 WARN Settings pattern “settingsSync." doesn’t match any settings
log.ts:191 WARN Settings pattern "sync.
” doesn’t match any settings

Gusti

Gusti OP

But these electron warnings were there at the start of VS Code, before I tried to format.

Gusti

Gusti OP

As I could not get it work, I created a VSCode Task, to execute “mix format”, and assigned it a keyboard sequence.
So, instead of pressing just Ctrl+S to save my file and format it, I need to press another key sequence after the save. It is not terribly bad. It’s a workaround, until somebody enlightens me.

Best regards,
Gusti.

hoetmaaiers

hoetmaaiers

Hi, I experience the same problem, the format command from VSCode does not trigger mix format. When running mix format from the CLI this goes well.

My Elixir-ls output log looks fine:

Started ElixirLS v0.8.1
Elixir version: "1.12.2 (compiled with Erlang/OTP 24)"
Erlang version: "24"
ElixirLS compiled with Elixir 1.10.4 and erlang 22
MIX_ENV: test
MIX_TARGET: 
Compiling 5 files (.ex)
Generated islands_engine app
[Info  - 8:14:41 AM] Compile took 1197 milliseconds
[Info  - 8:14:41 AM] [ElixirLS WorkspaceSymbols] Indexing...
MIX_ENV: test
MIX_TARGET: 
[Info  - 8:14:41 AM] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info  - 8:14:41 AM] [ElixirLS WorkspaceSymbols] 22 callbacks added to index
[Info  - 8:14:41 AM] [ElixirLS WorkspaceSymbols] 171 modules added to index
[Info  - 8:14:42 AM] Compile took 716 milliseconds
[Info  - 8:14:42 AM] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 8:14:42 AM] [ElixirLS Dialyzer] Found 11 changed files in 17 milliseconds
[Info  - 8:14:42 AM] [ElixirLS WorkspaceSymbols] 281 types added to index
[Info  - 8:14:42 AM] [ElixirLS Dialyzer] Analyzing 11 modules: [Collectable, Enumerable, IEx.Info, Inspect, IslandsEngine, IslandsEngine.Application, IslandsEngine.Coordinate, IslandsEngine.Guesses, IslandsEngine.Island, List.Chars, String.Chars]
[Info  - 8:14:42 AM] [ElixirLS Dialyzer] Analysis finished in 422 milliseconds
[Info  - 8:14:42 AM] Dialyzer analysis is up to date
[Info  - 8:14:42 AM] [ElixirLS Dialyzer] Writing manifest...
[Info  - 8:14:43 AM] [ElixirLS Dialyzer] Done writing manifest in 597 milliseconds.
[Info  - 8:14:44 AM] [ElixirLS WorkspaceSymbols] 3964 functions added to index

What else should I check into?

mattbaker

mattbaker

I’d bounce over to Issues · elixir-lsp/elixir-ls · GitHub to see if there are any similar issues logged (and create one if not).

Sebb

Sebb

Beware, that the code is not formatted if there are syntax errors.

mattbaker

mattbaker

FWIW I’ve been having trouble too (formatter.exs seems to not be respected) and rolled back to the previous version, I just haven’t been able to gather enough details to post a helpful issue yet :slight_smile: It doesn’t seem related to the existing issue about formatter.exs during compilation, but I need to double check first.

jameskent

jameskent

Try ctrl + shift + I. Check File, Preferences, Keyboard shortcuts.

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
mnkhod
So i have been using ash framework for a while and i love it. However currently the issue im having with ash framework is the error handl...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews