Seeing local files in SWISH


#1

I am running SWISH locally and want to use it as IDE. Is there any way to open local files?

Ideally, I’d like the source code of my file to appear in the source editor pane.


#2

If you look at ide.pl in swish, you see it defines

user:file_search_path(project, '.').
swish_config:source_alias(project, [access(both), search('*.pl')]).

This allows accessing real files as ../project/file.pl Once upon a time there was a search facility, but search has been reimplemented completely and this currently only supports the internal versioned store.


#3

Yes, I saw these lines and created softlink link ‘project’ pointing to directory with my files.They still do not appear in the left panel on a New tab or when I search.

Running the fragment below from lib/search.pl I see that it accesses my files but I still cannot access them from the UI.

swish_config:source_alias(Alias, AliasOptions),
        option(search(Pattern), AliasOptions),
        DirSpec =.. [Alias,.],
        absolute_file_name(DirSpec, Dir,
                           [ access(read),
                             file_type(directory),
                             solutions(all),
                             file_errors(fail)
                           ]),
        directory_file_path(Dir, Pattern, FilePattern),
        expand_file_name(FilePattern, Files),
        atom_concat(Dir, /, DirSlash),
        member(Path, Files),
        \+ source_file(Path),           % already did this one above
        atom_concat(DirSlash, File, Path),
        file_name_extension(Base, Ext, File),
        debug(swish(search), 'Searching ~q for ~q (~q)', [Path, Query, Options]),
       setup_call_cleanup(
            open(Path, read, In),
            read_string(In, _, String),
            close(In)),
        split_string(String, "\n", "\r", Lines),
        nth1(LineNo, Lines, Line).