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

[bug] Vscode extension v1.29.4 failing to load project #2162

Closed
Tracked by #10
iolyd opened this issue Jan 31, 2024 · 24 comments
Closed
Tracked by #10

[bug] Vscode extension v1.29.4 failing to load project #2162

iolyd opened this issue Jan 31, 2024 · 24 comments
Assignees
Labels
scope: inlang/sherlock-vscode Related to source-code/ide-extension. type: bug Something isn't working

Comments

@iolyd
Copy link

iolyd commented Jan 31, 2024

Problem

Inlang – i18n supercharged v1.29.4 can't seem to load a project that worked fine with major version release (v1.29.0).
I am getting the following error:

Failed to load project "/[redacted]/[repo]/project.inlang": TypeError: Invalid host defined options

...and inlang commands do not work anymore, and instead log:

Command 'inlang.[command]' not found

Expected behavior

Work as it did before.

Reproduction

  1. Update to latest version of vscode extension
  2. Reload window if required
  3. Open a repo with inlang setup
  4. Observe mentionned errors
  5. Downgrade to 1.29.0
  6. Reload window if required
  7. Observe things working fine

Other information

  • Vscode 1.85.2
  • Apple M2
  • Sonoma 14.3
@iolyd iolyd added the type: bug Something isn't working label Jan 31, 2024
@maige-app maige-app bot added the scope: inlang/sherlock-vscode Related to source-code/ide-extension. label Jan 31, 2024
@iolyd iolyd changed the title [bug] Vscode extension failing to load project [bug] Vscode extension v1.29.4 failing to load project Jan 31, 2024
@felixhaeberle
Copy link
Contributor

felixhaeberle commented Jan 31, 2024

@iolyd Can you probably share a minimal reproduction? I can't reproduce it with my setup.

cc @janfjohannes Probably related: https://discord.com/channels/897438559458430986/1085193211577897070/1200807711412068453

This is the only change which has been done in this file regarding the loading logic since the 1.29.0 release: 990803e see project.ts file / the fs fix you did?

@janfjohannes Can you investigate if openRepository& loadProject is correctly being used?

@felixhaeberle
Copy link
Contributor

felixhaeberle commented Feb 1, 2024

@opral/team does any of you have problems with the latest vs code extension? I can't reproduce this on my side.

edit: 3 additional team member can't reproduce this with v.1.29.4

@felixhaeberle
Copy link
Contributor

@iolyd can you possibly share your settings.json? Did you open the workspace root in vs code?

@NilsJacobsen
Copy link
Member

NilsJacobsen commented Feb 1, 2024

Same problem here:

{
    "$schema": "https://inlang.com/schema/project-settings",
    "sourceLanguageTag": "en",
    "languageTags": [
      "en", "de"
    ],
    "modules": [
      "https://cdn.jsdelivr.net/npm/@inlang/plugin-next-intl@latest/dist/index.js",
      "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
      "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
      "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
      "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js"
    ],
    "plugin.inlang.nextIntl": {
      "pathPattern": "./examples/example-app-router/messages/{languageTag}.json"
    }
  }
  

Error:
TypeError: Invalid host defined options

@NilsJacobsen
Copy link
Member

I updated my vscode from 1.85 to 1.86 that solved it for me @iolyd

@felixhaeberle felixhaeberle closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2024
@janfjohannes
Copy link
Contributor

@felixhaeberle i dont see any openRepo or loadProject in the linked commit. but i assume this is closed and solved anyways...

@iolyd
Copy link
Author

iolyd commented Feb 1, 2024

Ony my side, the problem persists after updating code to 1.86 regardless of if I use the extension's version 1.29.4 or 1.30.0.

Here's my project config:

{
  "$schema": "https://inlang.com/schema/project-settings",
  "sourceLanguageTag": "fr",
  "languageTags": ["fr", "en"],
  "modules": [
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-snake-case-id@latest/dist/index.js"
  ],
  "plugin.inlang.messageFormat": {
    "pathPattern": "./project.inlang/{languageTag}.json"
  }
}

(I know putting the message files alongside the settings file is probably not clean, but it hasn't caused any problem with paraglide.)

I also tested with another smaller project scaffolded more recently using npx @inlang/paraglide-js@latest init and am facing the same error:

{
  "$schema": "https://inlang.com/schema/project-settings",
  "sourceLanguageTag": "fr",
  "languageTags": ["fr", "en"],
  "modules": [
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
    "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
  ],
  "plugin.inlang.messageFormat": {
    "pathPattern": "./messages/{languageTag}.json"
  }
}

Both are SvelteKit projects. If just scaffolding a new SvelteKit project and then going through the paraglide setup doesn't give you the error, I don't really see how I could share a repro with anything more relevant.

@felixhaeberle
Copy link
Contributor

felixhaeberle commented Feb 1, 2024

@iolyd Is it possible that you can post a stack trace for this error?
This can be found in the developer console under "Help" -> "Toggle Developer Tools"

If just scaffolding a new SvelteKit project and then going through the paraglide setup doesn't give you the error

What did you change to trigger the error?

@iolyd
Copy link
Author

iolyd commented Feb 1, 2024

Sure thing!

notificationsAlerts.ts:42 Failed to load project "/Users/emmanuel/[redacted]/[repo]/project.inlang": TypeError: Invalid host defined options

ERR [Extension Host] TypeError: Cannot read properties of undefined (reading 'sourceLanguageTag')
    at lee (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.0/dist/main.cjs:789:3520)
    at gwt (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.0/dist/main.cjs:1007:1492)
    at TPr (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.0/dist/main.cjs:1007:995)
    at c.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6256)
    at c.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6219)
    at c.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5676)

@utkubakir
Copy link

utkubakir commented Feb 1, 2024

We are experiencing the same problem, config is here. Downgrading to 1.29.0 fixes the issue.

@felixhaeberle
Copy link
Contributor

felixhaeberle commented Feb 1, 2024

@utkubakir & @iolyd Can you verify that the issue first happened on v1.29.1 ?


@janfjohannes @jldec The IDE extension got a version bump from both @lix-js/client & @inlang/sdk in v1.29.1 – see CHANGELOG

I can only see the issue in the SDK, because nothing has changed from the IDE extension in regards to loadProject.

See

loadSettings({ settingsFilePath: projectPath + "/settings.json", nodeishFs })
.then((settings) => setSettings(settings))
&
const { sourceLanguageTag, languageTags } = settings as ProjectSettings
for potential error causes.

@jldec Can you take over?

@iolyd
Copy link
Author

iolyd commented Feb 1, 2024

@felixhaeberle Yes I can confirm the error first happens on v1.29.1 all the way up to latest. Sorry for creating confusion by mentioning v1.29.4, for some reason I though I had observed a different error on prior versions.

@LorisSigrist
Copy link
Member

LorisSigrist commented Feb 1, 2024

Screenshot 2024-02-01 at 18 10 16

The Error is being thrown at the hightlighted part. It's minified so I can only guess where that code comes from, but my best guess is that this is ide-extension/src/decorations/messagePreview.ts:55

Edit: It's

@jldec
Copy link
Contributor

jldec commented Feb 1, 2024

@felixhaeberle or @LorisSigrist are you able to repro this based on the information provided?

@felixhaeberle
Copy link
Contributor

felixhaeberle commented Feb 2, 2024

@iolyd & @utkubakir – we can't reproduce it on our side but push a fix regardless based on the error shown above.

can you test with the latest version 1.30.1 if the extension is working for you again?

thank you for your patience! 🙏

@iolyd
Copy link
Author

iolyd commented Feb 2, 2024

@felixhaeberle, yeah I saw the update roll out not long ago and tried it. The error persists, but the logs are a bit different now:

ERR [Extension Host] TypeError: Cannot read properties of undefined (reading 'customApi')
    at EPr (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.1/dist/main.cjs:1007:2511)
    at ywt (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.1/dist/main.cjs:1007:2082)
    at wPr (/Users/emmanuel/.vscode/extensions/inlang.vs-code-extension-1.30.1/dist/main.cjs:1007:1572)
    at c.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6256)
    at c.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6219)
    at c.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5676)

I tried making a completely new SvelteKit project from scratch with Paraglide and it appears to work in that repo, so there's definitely something related to how previous projects were setup. The thing is... one of my projects where the extension is throwing the error was scaffolded barely 3 weeks ago and didn't really have much work done in it, even less so when it comes to configs. I'll try and go my way back from where it is and see if I can pinpoint at which point the extension breaks.

Also, seeing as I'm not alone with this problem, I suggest keeping the issue open in the meantime.

@felixhaeberle
Copy link
Contributor

felixhaeberle commented Feb 2, 2024

so there's definitely something related to how previous projects were setup.

@LorisSigrist @janfjohannes @jldec Can you think of any change happening here?
As the user stated, this was introduced by the update of the SDK & Lix both @lix-js/client & @inlang/sdk in v1.29.1.

I suggest keeping the issue open in the meantime.

@iolyd Sure, sorry for closing too early. 🙏 We will fix this.

@utkubakir
Copy link

Can also confirm we are getting the same error on 1.30.1
image

@iolyd
Copy link
Author

iolyd commented Feb 2, 2024

@felixhaeberle Got it figured out! Or somewhat figured out. For some reason, my older projects would not generate the project.inlang/project_id file, even after updating all inlang-related project dependencies. I reinstalled said deps and now pnpm dev successfully generates the missing file, after what a simple window reload seems to fix things.

@felixhaeberle
Copy link
Contributor

cc @janfjohannes did you implement the project_id ?

@samuelstroschein
Copy link
Member

see #2070

@jldec
Copy link
Contributor

jldec commented Feb 6, 2024

@samuelstroschein here is my understanding on this issue

We do not have a proper repro for this, but we have a theory that project.settings are undefined during some part of the initialization. and @LorisSigrist pushed #2166 as a workaround/fix.

I have added this issue to the list in #1772

This issue is unrelated to #2070.

@jldec jldec closed this as completed Feb 6, 2024
@jldec
Copy link
Contributor

jldec commented Feb 6, 2024

adding additional comment here because there was confusion about project id generation

see #2101 (comment)
waiting for definitive way to ensure that projects have a project id. - #2069

@janfjohannes
Copy link
Contributor

@felixhaeberle yes, based on the description maybe some versioning issues with vscode extension dependencies? there was also some hickup changing some deps from bundled to external in paraglide, maybe this is similar....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: inlang/sherlock-vscode Related to source-code/ide-extension. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants