forked from helix-editor/helix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix type errors missing from +page.svelte file
- Loading branch information
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use lsp_types::Url; | ||
use std::fmt; | ||
|
||
use serde::de::{self, Visitor}; | ||
|
||
pub struct LspUriVisitor; | ||
|
||
impl<'de> Visitor<'de> for LspUriVisitor { | ||
type Value = lsp_types::Url; | ||
|
||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | ||
formatter.write_str("an uri") | ||
} | ||
|
||
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> | ||
where | ||
E: de::Error, | ||
{ | ||
return lsp_types::Url::parse(&std::borrow::Cow::into_owned( | ||
percent_encoding::percent_decode_str(v).decode_utf8_lossy(), | ||
)) | ||
.map_err(|e| E::custom(e)); | ||
} | ||
|
||
// Similar for other methods: | ||
// - visit_i16 | ||
// - visit_u8 | ||
// - visit_u16 | ||
// - visit_u32 | ||
// - visit_u64 | ||
} | ||
|
||
// Stopgap until: https://github.com/gluon-lang/lsp-types/issues/276 | ||
pub fn to_percent_decode_url(url: &Url) -> Url { | ||
return Url::parse(&std::borrow::Cow::into_owned( | ||
percent_encoding::percent_decode_str(url.as_str()).decode_utf8_lossy(), | ||
)) | ||
.expect("[Custom code]: failed to re-encode percent_decoded uri"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters