Skip to content

Commit

Permalink
feat: add get_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Aug 4, 2024
1 parent 9495faa commit 8f5d0c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lsp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

use std::ffi::OsStr;
use std::fmt::Debug;
use std::path::{Path, PathBuf};
use std::sync::{Mutex, MutexGuard};
Expand Down Expand Up @@ -59,6 +60,15 @@ impl Document {
fn get_filename(&self) -> &str {
return self.path.file_name().unwrap().to_str().unwrap();
}

fn get_extension(&self) -> &str {
return self
.path
.extension()
.unwrap_or(OsStr::new(""))
.to_str()
.unwrap();
}
}

impl Backend {
Expand Down

0 comments on commit 8f5d0c7

Please sign in to comment.