Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
project_dirs = lexical_shared lexical_plugin lexical_test
dialyzer_dirs = lexical_shared lexical_plugin

compile.all: compile.projects compile.umbrella
compile.all: compile.umbrella

dialyzer.all: compile.all dialyzer.projects dialyzer.umbrella
dialyzer.all: compile.all dialyzer.umbrella

test.all: test.projects test.umbrella
test.all: test.umbrella

dialyzer.plt.all: dialyzer.plt.projects dialyzer.plt.umbrella
dialyzer.plt.all: dialyzer.plt.umbrella

dialyzer.umbrella:
mix dialyzer

dialyzer.projects:
$(foreach dir, $(dialyzer_dirs), cd projects/$(dir) && mix dialyzer && cd ../..;)

dialyzer.plt.projects:
$(foreach dir, $(dialyzer_dirs), cd projects/$(dir) && mix dialyzer --plt && cd ../..;)

dialyzer.plt.umbrella:
mix dialyzer --plt

test.umbrella:
mix test

test.projects:
cd projects
$(foreach dir, $(project_dirs), cd projects/$(dir) && mix test && cd ../..;)

compile.umbrella: compile.projects
compile.umbrella:
mix deps.get
mix compile --skip-umbrella-children --warnings-as-errors

compile.projects:
cd projects
$(foreach dir, $(project_dirs), cd projects/$(dir) && mix deps.get && mix do clean, compile --warnings-as-errors && cd ../..;)

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Lexical do
@moduledoc """
Shared data structures and utilities for the Lexical Language Server.
Common data structures and utilities for the Lexical Language Server.

If you're building a plugin, You're probably going to want to look at the documentation
for core data structures like
Expand Down
2 changes: 0 additions & 2 deletions apps/common/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ defmodule Common.MixProject do

defp deps do
[
{:lexical_shared, path: "../../projects/lexical_shared"},
{:lexical_test, path: "../../projects/lexical_test", only: :test},
{:snowflake, "~> 1.0"},
{:sourceror, "~> 1.7"},
{:stream_data, "~> 1.1", only: [:test], runtime: false},
Expand Down
4 changes: 2 additions & 2 deletions apps/common/test/lexical/ast/env_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ defmodule Lexical.Ast.EnvTest do
use ExUnit.Case, async: true

alias Lexical.Ast
alias Lexical.Project

import Lexical.Ast.Env
import Lexical.Test.CursorSupport
import Lexical.Test.Fixtures

def new_env(text, opts \\ []) do
opts = Keyword.merge([as: :document], opts)
project = project()
project = Project.new("file://#{File.cwd!()}")
{position, document} = pop_cursor(text, opts)
analysis = Ast.analyze(document)
{:ok, env} = new(project, analysis, position)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ defmodule ElixirLS.LanguageServer.SourceFile.PathTest do

test "windows path" do
if windows?() do
drive_letter = Path.expand("/") |> String.split(":") |> hd()
drive_letter = "/" |> Path.expand() |> String.split(":") |> hd()
assert "file:///c%3A/win/path" == to_uri("c:/win/path")
assert "file:///c%3A/win/path" == to_uri("C:/win/path")
assert "file:///c%3A/win/path" == to_uri("c:/win/path/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ defmodule Lexical.ProjectTest do

describe "name/1" do
test "a project's name starts with a lowercase character and contains alphanumeric characters and _" do
check all folder_name <- string(:ascii, min_length: 1) do
patch Project, :folder_name, folder_name
check all(folder_name <- string(:ascii, min_length: 1)) do
patch(Project, :folder_name, folder_name)
assert Regex.match?(~r/[a-z][a-zA-Z_]*/, Project.name(project()))
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Lexical.Test.RangeSupport do
alias Lexical.Math
alias Lexical.Text
alias Lexical.Document
alias Lexical.Document.Position
alias Lexical.Document.Range
alias Lexical.Math
alias Lexical.Test.CursorSupport
alias Lexical.Text

import Lexical.Document.Line, only: [line: 1]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 7 additions & 25 deletions projects/lexical_credo/mix.exs → apps/lexical_credo/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ defmodule LexicalCredo.MixProject do
[
app: :lexical_credo,
version: @version,
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
package: package()
docs: docs()
]
end

Expand All @@ -27,11 +30,8 @@ defmodule LexicalCredo.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
env_dep(
hex: {:lexical_plugin, "~> 0.5"},
else: {:lexical_plugin, path: "../lexical_plugin"}
),
{:credo, "> 0.0.0", optional: true},
{:common, in_umbrella: true},
{:credo, "> 0.0.0", only: [:dev, :test]},
{:jason, "> 0.0.0", optional: true},
{:ex_doc, "~> 0.34", optional: true, only: [:dev, :hex]}
]
Expand All @@ -46,22 +46,4 @@ defmodule LexicalCredo.MixProject do
source_url: @repo_url
]
end

defp package do
[
licenses: ["Apache-2.0"],
description: "A plugin for the lexical language server that enables Credo checks",
links: %{
"Lexical Credo" => "https://github.com/lexical-lsp/lexical",
"Credo" => "https://github.com/rrrene/credo"
}
]
end

defp env_dep(opts) do
case Keyword.fetch(opts, Mix.env()) do
{:ok, dep} -> dep
:error -> Keyword.fetch!(opts, :else)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ defmodule LexicalCredoTest do
import LexicalCredo
use ExUnit.Case

setup_all do
Application.ensure_all_started(:credo)
:ok
end

def doc(contents) do
Document.new("file:///file.ex", contents, 1)
end
Expand All @@ -23,9 +28,9 @@ defmodule LexicalCredoTest do

assert {:ok, [%Result{} = result]} = has_inspect
assert result.position == {3, 5}
assert result.message == "There should be no calls to IO.inspect/1."
assert result.message == "There should be no calls to `IO.inspect/1`."
assert String.ends_with?(result.uri, "/file.ex")
assert result.severity == :error
assert result.severity == :warning
assert result.source == "Credo"
end
end
1 change: 0 additions & 1 deletion apps/proto/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ defmodule Proto.MixProject do
defp deps do
[
{:jason, "~> 1.4", optional: true},
{:lexical_shared, path: "../../projects/lexical_shared"},
{:common, in_umbrella: true}
]
end
Expand Down
2 changes: 0 additions & 2 deletions apps/protocol/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ defmodule Lexical.Protocol.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:lexical_shared, path: "../../projects/lexical_shared"},
{:lexical_test, path: "../../projects/lexical_test", only: :test},
{:common, in_umbrella: true},
{:jason, "~> 1.4", optional: true},
{:patch, "~> 0.15", only: [:test]},
Expand Down
7 changes: 1 addition & 6 deletions apps/remote_control/.formatter.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# Used by "mix format"
current_directory = Path.dirname(__ENV__.file)

import_deps =
if Mix.env() == :test do
[:lexical_test, :common]
else
[:common]
end
import_deps = [:common]

impossible_to_format = [
Path.join([
Expand Down
1 change: 0 additions & 1 deletion apps/remote_control/lib/mix/tasks/namespace.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ defmodule Mix.Tasks.Namespace do
# by this task. Plugin discovery uses this task, which happens after
# namespacing.
@extra_apps %{
"lexical_shared" => "Lexical",
"proto" => "Lexical",
"protocol" => "Lexical",
"remote_control" => "Lexical",
Expand Down
3 changes: 0 additions & 3 deletions apps/remote_control/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ defmodule Lexical.RemoteControl.MixProject do
{:common, in_umbrella: true},
{:elixir_sense,
github: "elixir-lsp/elixir_sense", ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"},
{:lexical_plugin, path: "../../projects/lexical_plugin"},
{:lexical_shared, path: "../../projects/lexical_shared"},
{:lexical_test, path: "../../projects/lexical_test", only: :test},
{:patch, "~> 0.15", only: [:dev, :test], optional: true, runtime: false},
{:path_glob, "~> 0.2", optional: true},
{:phoenix_live_view, "~> 1.0", only: [:test], optional: true, runtime: false},
Expand Down
2 changes: 0 additions & 2 deletions apps/server/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ defmodule Lexical.Server.MixProject do

defp deps do
[
{:lexical_shared, path: "../../projects/lexical_shared", override: true},
{:lexical_test, path: "../../projects/lexical_test", only: [:dev, :test]},
{:common, in_umbrella: true},
{:elixir_sense,
github: "elixir-lsp/elixir_sense", ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"},
Expand Down
1 change: 0 additions & 1 deletion integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN integration/boot/set_up_asdf.sh

COPY apps apps
COPY config config
COPY projects projects
COPY mix* .

RUN mix local.hex --force
Expand Down
1 change: 0 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ defmodule Lexical.LanguageServer.MixProject do
[
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
{:credo, "~> 1.7", only: [:dev, :test]},
{:lexical_credo, path: "projects/lexical_credo", only: [:dev, :test]},
Mix.Dialyzer.dependency()
]
end
Expand Down
2 changes: 1 addition & 1 deletion mix_dialyzer.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Mix.Dialyzer do
plt_core_path: absolute_path("priv/plts"),
plt_file: {:no_warn, absolute_path("priv/plts/#{name}.plt")},
plt_add_deps: :apps_direct,
plt_add_apps: [:wx, :mix, :ex_unit, :compiler],
plt_add_apps: [:compiler, :ex_unit, :jason, :mix, :wx],
ignore_warnings: absolute_path("dialyzer.ignore-warnings")
]
end
Expand Down
14 changes: 0 additions & 14 deletions projects/lexical_credo/mix.lock

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions projects/lexical_plugin/.formatter.exs

This file was deleted.

26 changes: 0 additions & 26 deletions projects/lexical_plugin/.gitignore

This file was deleted.

Loading
Loading