Comments (10)
Hey @drahnr, I investigated this issue a bit and as I see there are a bunch of todos in the code in regard of this issues. Which is really helpful.
Here's one comment which I'd love to have a cast light on :)
cargo-spellcheck/src/documentation.rs
Lines 19 to 23 in a26aee1
It's no clear to me if you want reuseVec<TrimmedLiteral>
and create just a marker of a type of documentation it holds.
Mainly as I see to use the current structure the work should be piled on existent types such as TrimmedLiteral
. But TrimmedLiteral
cann't be build from markdown filles (syn::parse_str
fails parsing it).
Firstly I tried to extract TrimmedLiteral
with removed corresponding field and create additional type RustTrimmedLiteral
which has this field . The idea was that markdown files produces TrimmedLiteral
but rust files RustTrimmedLiteral
. Eventually I hope there's another way here as this is far too complicated I would expect here, and that's why I am here :)
And as I understand for getting literals out of markdown there must be used a PlainOverlay
type, and specifically mapping
field right?
Some thoughts out of my mind as I kinda stuck with that 😞
from cargo-spellcheck.
I'll write smth up in a few minutes - I have an idea how to solve this cleanly and also help making #18 testable as a sideeffect :)
So the idea here is to make the the Documentation
independent of TrimmedLiteralSet
, but use a struct containing a String
and Range -> Span
mapping of the original file.
Note that this is non-trivial work, a few places need refactoring and calculation.
The first step is to introduce an enum like:
#[derive(Debug,Clone,Hash,Eq,PartialEq)]
enum ContentSource {
CommonMarkFile(PathBuf),
RustDocTest(PathBuf, Span), // span is just there to disambiguiate
RustSourceFile(PathBuf),
}
and use it with
pub struct Documentation {
index: IndexMap<ContentSource, Vec<CheckableChunk>>,
}
where CheckableChunk
struct CheckableChunk {
content: String,
source_lookup: IndexMap<Range,Span>
}
(CC @KuabeM which is what I meant when I said, decouple from proc_macro2::{Span,Literal}
which is extracted from TrimmedLiteralSet
/LiteralSet
. Anything later on should only work on CheckableChunk
s.
Does that make sense to you @zhiburt ?
Note that I significantly underestimated the changes needed for this, so I am going to remove the good first issue tag, let me know if you still want to tackle it :)
from cargo-spellcheck.
Please see #55 which includes most of what is needed :) feel free to pick it up from there, I left @todo
where things are left to do
from cargo-spellcheck.
@zhiburt #55 is almost done, given that, the fundamental structure is already there :)
from cargo-spellcheck.
You got pretty close, I wasn't sure so I implemented the surface part (almost the same as you did, take a look at e535f38 ) which is soon going to hit master soon - but I this was just the first step and there were plenty of other issues with that and actually required #25 to almost implemented - which was a bit of a heavy weight
Don't get discouraged, I'll try to add some conceptual overview graphics so it's easier to understand the individual components better :)
from cargo-spellcheck.
So #55 is complete and merged, feel free to take a shot or assign the issue back to me and I'll take over :)
from cargo-spellcheck.
😄 I actually took a shot ones to implement it but didn't got too far 😞
Sorry for my delays.
I'll try to put it in action one more and tell how it will be.
from cargo-spellcheck.
Got into frustration one more time 😄
I see that probably an only missed part is
cargo-spellcheck/src/traverse/mod.rs
Line 357 in 06940a5
Adding an item such as below to the map allows to see the .md
files in the output but awkwardly.
let mut source_mapping = IndexMap::new();
source_mapping.insert(
0..content.len(),
Span {
start: proc_macro2::LineColumn { line: 0, column: 0 },
end: proc_macro2::LineColumn { line: 0, column: 0 },
},
);
So I can't figure out how to put it on the rails properly yet :(
I you could give any clue would be helpful.
from cargo-spellcheck.
That would be roughly my approach too to just use a range / span covering the full markdown file.
Did you fork the repo again? Lots changed and the proc_macro2::Span
should not be used outside of CheckableChunk
construction anymore.
Could you create a PR and add some comments on what particular thing / section you do not understand plus your current attempted changes, that would allow me to give you better directions :)
from cargo-spellcheck.
It's not working properly 😞 but here it is
from cargo-spellcheck.
Related Issues (20)
- Spurious "Unexpected item made it into the items" warnings HOT 4
- Word "C++" is tokenized incorrectly and can not be whitelisted HOT 3
- Handle mdbook `book.toml`
- reflow sub command transposes `//` and leading space HOT 7
- Panic hunspell returned non-utf8 sequence HOT 7
- hunspell stumbles over copyright symbol HOT 5
- Broader CI/Docker usage support HOT 6
- How to ignore files HOT 7
- Build failure due to clang HOT 6
- How to add words? HOT 2
- Is there way to skip over doc links in comments? HOT 2
- Interactive fixing seems buggy HOT 3
- Support cargo-binstall HOT 9
- Reduce release artefact download size HOT 2
- Spellcheck doesn't list files when edition is inherited HOT 3
- Adding a footnote gives false positives HOT 2
- Is there a way to ignore commented out code? HOT 2
- Help identifying panic: `assertion failed: plain_range.start <= plain_range.end` HOT 15
- Non determinism with hunspell backend
- Installing the crate in a macbook machine HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-spellcheck.