Skip to content

Commit

Permalink
limit logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jan 21, 2024
1 parent 46196fb commit adb887f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
35 changes: 0 additions & 35 deletions apps/language_server/lib/language_server/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ defmodule ElixirLS.LanguageServer.Parser do
if should_parse?(uri, source_file) do
GenServer.cast(__MODULE__, {:parse_with_debounce, uri, source_file})
else
Logger.debug(
"Not parsing #{uri} version #{source_file.version} languageId #{source_file.language_id} with debounce"
)

:ok
end
end
Expand All @@ -62,10 +58,6 @@ defmodule ElixirLS.LanguageServer.Parser do
%Context{} = context -> context
end
else
Logger.debug(
"Not parsing #{uri} version #{source_file.version} languageId #{source_file.language_id} immediately"
)

# not parsing - respond with empty struct
%Context{
source_file: source_file,
Expand Down Expand Up @@ -171,19 +163,11 @@ defmodule ElixirLS.LanguageServer.Parser do

case {files[uri], Map.has_key?(state.parse_pids, {uri, current_version})} do
{%Context{parsed_version: ^current_version} = file, _} ->
Logger.debug(
"#{uri} version #{current_version} languageId #{source_file.language_id} already parsed"
)

file = maybe_fix_missing_env(file, position)

{:reply, file, state}

{_, true} ->
Logger.debug(
"#{uri} version #{current_version} languageId #{source_file.language_id} is currently being parsed"
)

state = %{state | queue: state.queue ++ [{{uri, current_version, position}, from}]}
{:noreply, state}

Expand All @@ -197,21 +181,13 @@ defmodule ElixirLS.LanguageServer.Parser do
updated_file =
case other do
nil ->
Logger.debug(
"Parsing #{uri} version #{current_version} languageId #{source_file.language_id} immediately"
)

%Context{
source_file: source_file,
path: get_path(uri)
}

%Context{source_file: %SourceFile{version: old_version}} = old_file
when old_version <= current_version ->
Logger.debug(
"Parsing #{uri} version #{current_version} languageId #{source_file.language_id} immediately"
)

%Context{old_file | source_file: source_file}
end

Expand Down Expand Up @@ -239,10 +215,6 @@ defmodule ElixirLS.LanguageServer.Parser do
file = Map.fetch!(files, uri)
version = file.source_file.version

Logger.debug(
"Parsing #{uri} version #{version} languageId #{file.source_file.language_id} after debounce"
)

parent = self()

{pid, ref} =
Expand Down Expand Up @@ -355,11 +327,9 @@ defmodule ElixirLS.LanguageServer.Parser do
cursor_position
) do
{:ok, acc} ->
Logger.debug("Fixed missing env")
ElixirSense.Core.Metadata.fill(source_file.text, acc)

_ ->
Logger.debug("Not able to fix missing env")
metadata
end

Expand Down Expand Up @@ -420,16 +390,13 @@ defmodule ElixirLS.LanguageServer.Parser do

case ElixirSense.Core.Parser.string_to_ast(source_file.text, options) do
{:ok, ast, modified_source, _error} ->
Logger.debug("Syntax error fixed")

metadata =
MetadataBuilder.build(ast)
|> fix_missing_env(modified_source, cursor_position)

{{:fixed, cursor_position}, ast, metadata}

_ ->
Logger.debug("Not able to fix syntax error")
# we can't fix it
{{:not_parsable, cursor_position}, @dummy_ast, @dummy_metadata}
end
Expand Down Expand Up @@ -465,11 +432,9 @@ defmodule ElixirLS.LanguageServer.Parser do
cursor_position
) do
{:ok, acc} ->
Logger.debug("Fixed missing env")
acc

_ ->
Logger.debug("Not able to fix missing env")
acc
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbols do

# indexed and no uris modified or already indexing
def handle_cast(:build_complete, state) do
IO.puts("build_complete not indexing #{inspect(state.modified_uris)}")
{:noreply, state}
end

Expand Down Expand Up @@ -355,15 +354,11 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbols do
if res > 0.0 and kind_code not in @module_kind_codes and length(query_parts) == 1 and
not Matcher.match?(" " <> last_part_downcase, " " <> query_downcase) do
# exclude functions/types/callbacks when module matches and function/type/callback does not contribute
# IO.puts("excluding #{name}")
0.0
else
res
end

# if res > 0 do
# IO.puts("#{query} #{name} #{res}")
# end
res
end

Expand Down

0 comments on commit adb887f

Please sign in to comment.