Closed dadonzg closed 4 years ago
I have a feeling there are some quirks to how you configure local file loading in some IDEs. I don't know if this is the cause, but try prepending your local file with a URI prefix like file://some/path/all-spec.json
and see if that gets you anywhere.
Hi @rjlohan :)
Thanks for your reactivity,
I tried file:///path/to/schema/all-spec.json
and file://path/to/schema/all-spec.json
(without the triple /
)
And I got an error "Schema file doesn't exist"
Oh I have to precise, I am using the eu-central-1
file. Idk if it's change something
@rjlohan : I found the root cause of the issue.
Oddly, Pycharm seems to use the settings for intellisense when it load a schema file. The settings used is idea.max.intellisense.filesize
idea.max.intellisense.filesize
: Sets the maximum size of files (in kilobytes) for which PyCharm provides code assistance. (https://www.jetbrains.com/help/pycharm/file-idea-properties.htmll)
It's weird because the setting is related to the current file edited and not a schema. It is not documented anywhere.
And by default idea.max.intellisense.filesize
is 2500kb
.
But now the all-spec.json
is 2600kb
(Compare to the old file which is 1700kb
)
That's why it is not working.
If I change the settings to idea.max.intellisense.filesize=3000
it is working locally and Pycharm load the file.
I guess using the http
protocol to load the file bypassed that restriction.
Can I add that somewhere to the documentation (Here https://github.com/aws-cloudformation/aws-cloudformation-template-schema/blob/master/docs/pycharm/instructions.md) and send a PR?
Ah nice work! Yes please, would love all PRs you are willing to throw our way 😄
Good Morning,
First thank you very much for this tool, this is super useful and make me way more productive using cloudformation!
I have a strange issue and I don't know if it's related to Pycharm or this project, and maybe you could help me on my investigations.
OS: macOS Mojave 10.14.6 IDE: Pycharm 2019.3.3
I am generating the schema using this project by running
java -jar target/aws-cloudformation-template-schema-1.0-SNAPSHOT-jar-with-dependencies.jar --output-dir out/
When I add the schema using the local path
/path/to/all-spec.json
to my PycharmPreferences | Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings
I got the following error:JSON Schema not found or contain error in 'all-spec.json': Can not load code model for JSON Schema file 'all-spec.json'
But if I set up a local server using
python -m SimpleHTTPServer
and add the localhost url (http://localhost:8000/all-spec.json
) to PycharmPreferences | Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings
then it is workingI tried to download an old file here https://s3.amazonaws.com/cfn-resource-specifications-us-east-1-prod/schemas/2.15.0/all-spec.json and load it locally and it is working locally
So I don't understand why I have an error when I load the generated file locally and not through http. And why I don't have an error with the old file.
I did a
vimdiff
to try to understand all the difference but it's hard for me to track.The generated file is
2.6mb
and the old file is1.7mb
but idk if it's relatedThe Unix right are the same.
Do you know a way to check if it's related to pycharm or not?
Did you encounter this issue?
Feel free to reach me if you have any questions,
Thanks!