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

Imports not working, no error displayed in IDE #30

Open
mickdekkers opened this issue Jun 28, 2017 · 7 comments
Open

Imports not working, no error displayed in IDE #30

mickdekkers opened this issue Jun 28, 2017 · 7 comments
Labels

Comments

@mickdekkers
Copy link

Hi!

I'm loving the web IDE so far, but it seems imports aren't working.

If I copy the imports example from http://doc.kaitai.io/user_guide.html#_importing_types_from_other_files and open the filelist.ksy file in the IDE, the object tree is not updated (it stays blank or open on the previous ksy file) but there are no errors visible in the IDE.

If I open the browser console, I can see these errors:

As text:

localforage.js:836 [performance/29.891] YAML parsing took 1 milliseconds.
localforage.js:836 import yaml: date, mode: rel
localforage.js:836 import yaml: date, mode: rel
localforage.js:836 GET https://ide.kaitai.io/formats/date.ksy 404 ()
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 XHR finished loading: GET "https://ide.kaitai.io/formats/date.ksy".
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
/#:1 Uncaught (in promise) Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}
Promise rejected (async)
j @ jquery-3.1.1.min.js:2
k @ jquery-3.1.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
fire @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
A @ jquery-3.1.1.min.js:4
(anonymous) @ jquery-3.1.1.min.js:4
XMLHttpRequest.send (async)
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:100
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 GET https://ide.kaitai.io/formats/date.ksy 404 ()
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:101
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
localforage.js:836 XHR finished loading: GET "https://ide.kaitai.io/formats/date.ksy".
send @ jquery-3.1.1.min.js:4
ajax @ jquery-3.1.1.min.js:4
get @ /js/app.files.js:55
(anonymous) @ /js/app.js:37
importYaml @ /js/app.js:35
$c_Lio_kaitai_struct_format_JavaScriptClassSpecs.doImport__T__T__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:68200
$c_Lio_kaitai_struct_precompile_LoadImports.io$kaitai$struct$precompile$LoadImports$$loadImport__T__sci_List__s_Option__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7953
(anonymous) @ kaitai-struct-compiler-fastopt.js:7825
$c_Lio_kaitai_struct_precompile_LoadImports.processClass__Lio_kaitai_struct_format_ClassSpec__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:7838
$c_Lio_kaitai_struct_Main$.importAndPrecompile__Lio_kaitai_struct_format_ClassSpecs__Lio_kaitai_struct_RuntimeConfig__s_concurrent_Future @ kaitai-struct-compiler-fastopt.js:4719
$c_Lio_kaitai_struct_MainJs$.compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__sjs_js_Promise @ kaitai-struct-compiler-fastopt.js:4892
$c_Lio_kaitai_struct_MainJs$.$$js$exported$meth$compile__T__sjs_js_Object__Lio_kaitai_struct_JavaScriptImporter__Z__O @ kaitai-struct-compiler-fastopt.js:4821
$c_Lio_kaitai_struct_MainJs$.compile @ kaitai-struct-compiler-fastopt.js:4945
compile @ /js/app.js:101
copyPromise.then.then @ /js/app.js:127
Promise resolved (async)
copyPromise.then @ /js/app.js:126
Promise resolved (async)
localforage.getItem.then.ksyFsItem @ /js/app.js:123
Promise resolved (async)
req.onsuccess @ localforage.js:836
IndexedDB (async)
(anonymous) @ localforage.js:826
/#:1 Uncaught (in promise) Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}

It looks like it's trying to retrieve the date.ksy file from https://ide.kaitai.io/formats/date.ksy, but that's returning a 404 which is not caught.

Kaitai WebIDE version: 0.1.0.2207 (license)
Kaitai compiler version: 0.7 (2017-04-26 20:06:21.086)
Chrome version 58.0.3029.110 (64-bit)
Windows 10 64-bit
@koczkatamas
Copy link
Member

Thanks for reporting!

I'll try to fix in the next days.

(Connected issue: #24)

@GreyCat GreyCat added the bug label Jun 28, 2017
@mickdekkers
Copy link
Author

Great, thanks! 😄

@koczkatamas
Copy link
Member

koczkatamas commented Jun 29, 2017

Hopefully fixed with 2b47c9a. (only on stable, I did not port the patch to /devel yet).

@mickdekkers
Copy link
Author

@koczkatamas thanks for picking this up! Relative imports in the same directory work now, but it throws an error in the browser console if you try to use subdirectories:

@mickdekkers
Copy link
Author

mickdekkers commented Jun 29, 2017

It looks like subdirectories don't work fully in the first place.
If you create a file in the root with some name, e.g. vsval, and then create a file with the same name in a subdirectory, the new file overwrites the old one even though they're in different directories.

See screen recording: https://puu.sh/wxdLl/70735a4110.mp4

@koczkatamas
Copy link
Member

koczkatamas commented Jun 29, 2017

Yeah sorry for that, it's actually a different issue. The whole file handling is a big hack in the current WebIDE, the files actually are stored by their name only (vsval.ksy in both cases) and there is no warning or what so ever if you overwrite files this way. Renaming also causes this kind of inconsistency.

These hopefully will be fixed in V2, but there is no ETA when it will be released.

Till then please only use flat file structure. Sorry again for that :S

@mickdekkers
Copy link
Author

mickdekkers commented Jun 29, 2017

No worries, but it may be a good compromise to disable the create folder button on production in the meantime.

Edit: Or perhaps add a simple window.confirm call to warn the user about this limitation when it's about to overwrite a file.

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

No branches or pull requests

3 participants