Exemplo n.º 1
0
    def test_copy_text(self):
        with tempfile.TemporaryDirectory() as directory:
            source = ResourcePath("Packages/test_package/helloworld.txt")
            destination = Path(directory) / 'helloworld.txt'

            source.copy(destination)

            self.assertTrue(destination.is_file())

            with open(str(destination), 'r') as file:
                text = file.read()

            self.assertEqual(text, source.read_text())
Exemplo n.º 2
0
 def handle_vscode_content(self, uri, respond):
     name = uri.split('/')[-1]
     schema_resource = ResourcePath('Packages', self.package_name,
                                    'schemas', '{}.json'.format(name))
     respond(schema_resource.read_text())
Exemplo n.º 3
0
 def _parse_schema(self, resource: ResourcePath) -> Any:
     try:
         return sublime.decode_value(resource.read_text())
     except Exception:
         print('Failed parsing schema "{}"'.format(resource.file_path()))
         return None