Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific file is not watched #125

Closed
fredrikekre opened this issue Jul 8, 2021 · 5 comments · Fixed by #127
Closed

Specific file is not watched #125

fredrikekre opened this issue Jul 8, 2021 · 5 comments · Fixed by #127

Comments

@fredrikekre
Copy link
Contributor

Hi, I tried LiveServe.servedocs with Literate and it seems to work except the file docs/src/outputformats.md is not watched for some reason. Changes to all other files trigger a rebuild.

I ran this from the Literate.jl root:

julia --project=docs -e 'using LiveServer; LiveServer.servedocs(; skip_dir="docs/src/generated")

The only unique thing with this file (compared to the other) is that there is also a file docs/src/outputformats.jl, but don't quite know why that would matter.

@fredrikekre
Copy link
Contributor Author

Yep, seems like that is the problem. Changing it to outputformats2.md works.

@fredrikekre
Copy link
Contributor Author

if isempty(literate)
# assumption is that the scripts are in `docs/src/...` and that the generated markdown
# goes in exactly the same spot so for instance:
# docs
# └── src
# ├── index.jl
# └── index.md
for wf dw.watchedfiles
spath = splitext(wf.path)
spath[2] == ".jl" || continue
k = findfirst(e -> splitext(e.path) == (spath[1], ".md"), dw.watchedfiles)
k === nothing || push!(remove, k)
end

Why is that there?

@tlienart
Copy link
Owner

tlienart commented Jul 9, 2021

Hello Fredrik,

The procedure expected with literate is outlined here: https://tlienart.github.io/LiveServer.jl/dev/man/ls+lit/#Modifying-the-make-file meaning that if there's a file literate_src.jl you'll get a literate_src.md in the same folder which shouldn't be watched otherwise there's an infinite triggering (make.jl file executed -> generates .md file -> triggers -> make.jl file executed)

I think here the issue is rather that you're not using Literate and so this code should not apply to your case. I think the correct thing to do would be to have default literate=nothing) (meaning that we don't expect to use Literate), and then if the user wants either literate="" or literate="path/to/literate_files/ .

@fredrikekre
Copy link
Contributor Author

The procedure expected with literate is outlined here: https://tlienart.github.io/LiveServer.jl/dev/man/ls+lit/#Modifying-the-make-file meaning that if there's a file literate_src.jl you'll get a literate_src.md in the same folder which shouldn't be watched otherwise there's an infinite triggering (make.jl file executed -> generates .md file -> triggers -> make.jl file executed)

Yes, but I thought it was opt-in? I am not specifying that I am using Literate here, but perhaps I misunderstood the meaning of the literate keyword argument.

@tlienart
Copy link
Owner

tlienart commented Jul 9, 2021

yes this is the problem; the default is literate="" which still assumes that you might be using literate but in the current directory.

What I'm suggesting is to have default be literate=nothing and then have the user specify explicitly either literate="" or literate="path/to" in which case the behaviour would be triggered. I'll add that now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants