Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Formatting seems to be broken? #242

Closed
nrc opened this issue Apr 5, 2017 · 4 comments
Closed

Formatting seems to be broken? #242

nrc opened this issue Apr 5, 2017 · 4 comments

Comments

@nrc
Copy link
Member

nrc commented Apr 5, 2017

I'm trying to format file below and VSCode is not really responding at all. I see no useful info in the output panel.

// Copyright 2016 The RLS Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.


use std::path::{PathBuf};
use {Def, Analysis};

    pub fn mk_src_url(def: &Def, path_prefix: Option<&PathBuf>, analysis: &Analysis) -> Option<String> {
        let path_prefix = match path_prefix {
            Some(pp) => pp,
            None => return
            None,
        };
        let file_path = &def.span.file;
        let file_path = match file_path.strip_prefix(&path_prefix) {
            Ok(p) => p,
            Err(_) => return None,
        };

        if def.api_crate {
            Some(format!("{}/{}#L{}-L{}",
                         analysis.src_url_base,
                         file_path.to_str().unwrap(),
                         def.span.range.row_start.one_indexed().0,
                         def.span.range.row_end.one_indexed().0))
        } else {
            None
        }
    }
@ishitatsuyuki
Copy link
Contributor

One thing I know is that it will silently fail when line exceeds 100. There will be the same message if you run rustfmt manually.

@sophiajt
Copy link

Not sure if this is related, but we moved formatting behind a flag. It's now under unstable_features, which you can read about here: https://github.com/rust-lang-nursery/rls#configuration

@sophiajt
Copy link

(heh, just realised nrc is who filed this... but maybe that's helpful for other people)

@nrc
Copy link
Member Author

nrc commented May 28, 2017

Confirmed this is now fixed.

@nrc nrc closed this as completed May 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants