add profile calls to real-time requests

This commit is contained in:
Aleksey Kladov 2019-05-27 11:48:23 +03:00
parent bdd779aa44
commit ce040aa907

View file

@ -64,6 +64,7 @@ pub fn handle_selection_range(
world: ServerWorld, world: ServerWorld,
params: req::SelectionRangeParams, params: req::SelectionRangeParams,
) -> Result<Vec<req::SelectionRange>> { ) -> Result<Vec<req::SelectionRange>> {
let _p = profile("handle_selection_range");
let file_id = params.text_document.try_conv_with(&world)?; let file_id = params.text_document.try_conv_with(&world)?;
let line_index = world.analysis().file_line_index(file_id); let line_index = world.analysis().file_line_index(file_id);
params params
@ -104,6 +105,7 @@ pub fn handle_find_matching_brace(
world: ServerWorld, world: ServerWorld,
params: req::FindMatchingBraceParams, params: req::FindMatchingBraceParams,
) -> Result<Vec<Position>> { ) -> Result<Vec<Position>> {
let _p = profile("handle_find_matching_brace");
let file_id = params.text_document.try_conv_with(&world)?; let file_id = params.text_document.try_conv_with(&world)?;
let line_index = world.analysis().file_line_index(file_id); let line_index = world.analysis().file_line_index(file_id);
let res = params let res = params
@ -122,6 +124,7 @@ pub fn handle_join_lines(
world: ServerWorld, world: ServerWorld,
params: req::JoinLinesParams, params: req::JoinLinesParams,
) -> Result<req::SourceChange> { ) -> Result<req::SourceChange> {
let _p = profile("handle_join_lines");
let frange = (&params.text_document, params.range).try_conv_with(&world)?; let frange = (&params.text_document, params.range).try_conv_with(&world)?;
world.analysis().join_lines(frange).try_conv_with(&world) world.analysis().join_lines(frange).try_conv_with(&world)
} }
@ -130,6 +133,7 @@ pub fn handle_on_enter(
world: ServerWorld, world: ServerWorld,
params: req::TextDocumentPositionParams, params: req::TextDocumentPositionParams,
) -> Result<Option<req::SourceChange>> { ) -> Result<Option<req::SourceChange>> {
let _p = profile("handle_on_enter");
let position = params.try_conv_with(&world)?; let position = params.try_conv_with(&world)?;
match world.analysis().on_enter(position) { match world.analysis().on_enter(position) {
None => Ok(None), None => Ok(None),
@ -141,6 +145,7 @@ pub fn handle_on_type_formatting(
world: ServerWorld, world: ServerWorld,
params: req::DocumentOnTypeFormattingParams, params: req::DocumentOnTypeFormattingParams,
) -> Result<Option<Vec<TextEdit>>> { ) -> Result<Option<Vec<TextEdit>>> {
let _p = profile("handle_on_type_formatting");
let file_id = params.text_document.try_conv_with(&world)?; let file_id = params.text_document.try_conv_with(&world)?;
let line_index = world.analysis().file_line_index(file_id); let line_index = world.analysis().file_line_index(file_id);
let position = FilePosition { let position = FilePosition {