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

WebIDE does not support subdirectory imports #172

Open
kendallgoto opened this issue Apr 23, 2024 · 2 comments
Open

WebIDE does not support subdirectory imports #172

kendallgoto opened this issue Apr 23, 2024 · 2 comments

Comments

@kendallgoto
Copy link

It seems that using imports within the webIDE, where the desired file is nested in a folder, causes an error whereas it otherwise works on the compiler interface. For example:

meta:
  id: test
  file-extension: test
  imports:
  - something
seq:
- id: dummy
  type: something

will work fine, provided that a something.ksy file exists which provides the type something.
image

However,

meta:
  id: test
  file-extension: test
  imports:
  - something
  - another/another
seq:
- id: dummy
  type: something
- id: dummy2
  type: another

will provide the unclear error "Cannot read properties of null (reading 'indexOf')" as it gets a null value back from resolving another/another, even if the file another/another.ksy provides the type. Instead, it seems that the directory structure is flattened for localfs, and the file is retrieved via just another.
image

This unclear "cannot read properties of null" error will get emitted if you import any nonexistent file (e.g. kaitaiIde.app.compilerService.jsImporter.importYaml('garbage/path', 'rel')) and should be replaced with a more clear indication. Further, if directories are supported in the UI, those directories should be respected in the fs lookups, rather than replacing them with a flattened copy.

This is loosely documented in #30, but I wanted to re-draw attention to it with a more aptly named issue since it's still an open limitation (from 7 years ago).

@generalmimon
Copy link
Member

This unclear "cannot read properties of null" error will get emitted if you import any nonexistent file (e.g. kaitaiIde.app.compilerService.jsImporter.importYaml('garbage/path', 'rel')) and should be replaced with a more clear indication.

Fixed in #161 and available for testing at https://ide.kaitai.io/devel/. The difference in Web IDE versions is explained at https://doc.kaitai.io/user_guide.html#web-ide.

This is loosely documented in #30, but I wanted to re-draw attention to it with a more aptly named issue since it's still an open limitation (from 7 years ago).

Yeah, as already discussed in #30, the "Create folder" button unfortunately only looks like it creates a folder. In reality, the files you seemingly put into it effectively still go to the root level (with everything that comes with it).

In theory, this shouldn't be that hard to fix properly (i.e. finally implement folders) but apparently nobody has gotten around to it yet. In the meantime, I believe we should indeed at least disable the "Create folder" button as suggested in #30 (comment) so that it doesn't confuse newcomers (but that doesn't solve the problem for existing Web IDE users who already have some "directory structure" persisted in their local browser storage and haven't noticed this problem yet).

@kendallgoto
Copy link
Author

thanks for highlighting the hosted devel version - I had forgotten that was running + was trying to avoid spinning up the repo to run locally. i'm OK to close this issue as a dupe unless you think it's otherwise valuable to renew tracking of a fix / disabling the button as per #30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants