class Savi::Compiler::SourceService
- Savi::Compiler::SourceService
- Reference
- Object
Defined in:
savi/compiler/source_service.crConstructors
Instance Method Summary
- #core_package_internal_path : String
- #core_package_internal_path=(core_package_internal_path : String)
- #core_savi_package_path
-
#find_latest_in_deps(ctx, dep : Packaging::Dependency) : String | Nil
Find a dependency in the local
deps
dir which matches the given dep spec. -
#find_relative_dep(ctx, dep : Packaging::Dependency) : String | Nil
Find a dependency that has a local relative path as its location.
-
#get_directory_sources(dirname : String, package : Source::Package)
Given a directory name, load source objects for all the source files in it.
-
#get_manifest_sources_at(dirname : String)
Given a directory name, load source objects for all the source files in it.
-
#get_manifest_sources_at_or_above(dirname : String)
Given a directory name, load manifest sources in it, or in the nearest directory above it that contains manifest sources.
-
#get_recursive_sources(root_dirname, language = :savi)
Given a directory name, load source objects for all the source files in each subdirectory of that root directory, grouped by source package.
-
#get_source_at(path, source_package)
Get the source object at the given path, either an override or real file.
-
#get_sources_for_manifest(ctx, manifest : Packaging::Manifest)
Given a manifest, load source objects for all the source files in its paths.
- #main_directory_remap : Tuple(String, String) | Nil
- #main_directory_remap=(main_directory_remap : Tuple(String, String) | Nil)
- #meta_declarators_package_path
-
#overwrite_source_at(path, content)
Write the given content to the source file at the given path.
-
#set_source_override(path, content)
Add/update a source override, which causes the SourceService to pretend as if there is a file at the given path with the given content in it.
- #standard_declarators_package_path
- #standard_directory_remap : Tuple(String, String) | Nil
- #standard_directory_remap=(standard_directory_remap : Tuple(String, String) | Nil)
-
#unset_source_override(path)
Remove the source override at the given path, if it exists.
Constructor Detail
Instance Method Detail
Find a dependency in the local deps
dir which matches the given dep spec.
Find a dependency that has a local relative path as its location.
Given a directory name, load source objects for all the source files in it.
Given a directory name, load source objects for all the source files in it.
Given a directory name, load manifest sources in it, or in the nearest directory above it that contains manifest sources.
Given a directory name, load source objects for all the source files in each subdirectory of that root directory, grouped by source package.
Get the source object at the given path, either an override or real file.
Given a manifest, load source objects for all the source files in its paths.
Write the given content to the source file at the given path. Note that these changes may not be visible if the real file is being shadowed by a source override (which this operation will not affect).
Add/update a source override, which causes the SourceService to pretend as if there is a file at the given path with the given content in it.
If there really is a file at that path, the source override will shadow it, overriding the real content of the file for as long as the override exists. If there is no such file at that path, the source override makes the system pretend as if there is a file there, so it will show up in that directory if and when the directory is compiled as a package in the program.
This is used by editor-interactive systems like the language server, allowing the content in the text editor that has opened the given file to temporarily override whatever content is actually saved to disk there. This allows us to compile as the user is typing, even if they haven't saved.
Remove the source override at the given path, if it exists.
This corresponds to the closing of a file in a text editor.
See docs for #set_source_override
for more information.