How to get a Document from a VirtualFile?

I'm just starting to play with the OpenAPI and have a question. I have the URL of a project file and need a Document to this file. The following works in a small test project but in my real project the Document always seems to be NULL. Is there anything wrong with the code?



Found the problem myself. It was an URL to a file in an ignored folder.