Skip to content

Commit

Permalink
Fixed document naming change stragglers
Browse files Browse the repository at this point in the history
Edits -> Changes and the .iex.exs file was missed
  • Loading branch information
scohen committed Apr 28, 2023
1 parent 2762352 commit 94be93a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions .iex.exs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
alias Lexical.RemoteControl
alias Lexical.SourceFile
alias Lexical.SourceFile.Position
alias Lexical.Document
alias Lexical.Document.Position

defmodule Helpers do
alias Lexical.Project
alias Lexical.Document.Position
alias Lexical.Project
alias Lexical.Protocol.Types.Completion
alias Lexical.Server.CodeIntelligence
alias Lexical.SourceFile.Position

def observer do
:observer.start()
Expand All @@ -19,20 +18,20 @@ defmodule Helpers do
|> RemoteControl.call(:observer, :start)
end

def sf(text) do
sf(:lexical, text)
def doc(text) do
doc(:lexical, text)
end

def sf(project, text) do
def doc(project, text) do
root_path =
project
|> project()
|> Project.root_path()

[root_path, "lib", "file.ex"]
|> Path.join()
|> SourceFile.Path.to_uri()
|> SourceFile.new(text, 0)
|> Document.Path.to_uri()
|> Document.new(text, 0)
end

def pos(line, character) do
Expand All @@ -48,28 +47,28 @@ defmodule Helpers do
def compile_file(project, source) when is_binary(source) do
project
|> ensure_project()
|> compile_file(sf(source))
|> compile_file(doc(source))
end

def compile_file(project, %SourceFile{} = source_file) do
def compile_file(project, %Document{} = document) do
project
|> ensure_project()
|> RemoteControl.Api.compile_source_file(source_file)
|> RemoteControl.Api.compile_document(document)
end

def complete(project, source, context \\ nil)

def complete(project, source, context) when is_binary(source) do
case completion_position(source) do
{:found, line, character} ->
complete(project, sf(source), line, character, context)
complete(project, doc(source), line, character, context)

other ->
other
end
end

def complete(project, %SourceFile{} = source, line, character, context) do
def complete(project, %Document{} = source, line, character, context) do
context =
if is_nil(context) do
Completion.Context.new(trigger_kind: nil)
Expand Down Expand Up @@ -132,7 +131,7 @@ defmodule Helpers do
|> String.graphemes()
|> Enum.find_index(&(&1 == "|"))

{:halt, {:found, line_number, index}}
{:halt, {:found, line_number + 1, index + 1}}
else
{:cont, :not_found}
end
Expand Down
File renamed without changes.

0 comments on commit 94be93a

Please sign in to comment.