Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/elephp/phpls/g #148

Merged
merged 2 commits into from
Apr 14, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/elephp
/phpls
.task
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tasks:
build:
deps: [generate]
cmds:
- go build -o elephp cmd/elephp/main.go
- go build -o phpls -ldflags="-s -w" cmd/phpls/main.go
sources:
- cmd/**/*
- internal/**/*
Expand All @@ -22,7 +22,7 @@ tasks:
- go.mod
- go.sum
generates:
- elephp
- phpls

test:
deps: [generate]
Expand All @@ -45,4 +45,4 @@ tasks:
# Tail the latest log file from wherever you are.
logs:
cmds:
- tail -f $(ls -cl $(elephp logs)/* | tail -n 1 | rev | cut -d' ' -f1 | rev)
- tail -f $(ls -cl $(phpls logs)/* | tail -n 1 | rev | cut -d' ' -f1 | rev)
10 changes: 5 additions & 5 deletions cmd/elephp/main.go → cmd/phpls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"os"

"github.com/arl/statsviz"
"github.com/laytan/elephp/internal/config"
"github.com/laytan/elephp/internal/logging"
"github.com/laytan/elephp/internal/server"
"github.com/laytan/elephp/pkg/connection"
"github.com/laytan/elephp/pkg/processwatch"
"github.com/laytan/phpls/internal/config"
"github.com/laytan/phpls/internal/logging"
"github.com/laytan/phpls/internal/server"
"github.com/laytan/phpls/pkg/connection"
"github.com/laytan/phpls/pkg/processwatch"

// TODO: what is the difference between jsonrpc2 and jsonrpc2_v2?
"github.com/laytan/go-lsp-protocol/pkg/jsonrpc2"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/laytan/elephp
module github.com/laytan/phpls

go 1.20

Expand Down
34 changes: 17 additions & 17 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/cristalhq/aconfig"
"github.com/cristalhq/aconfig/aconfigyaml"
"github.com/danielgtaylor/huma/schema"
"github.com/laytan/elephp/pkg/phpversion"
"github.com/laytan/phpls/pkg/phpversion"
"github.com/xeipuuv/gojsonschema"
)

Expand All @@ -24,22 +24,22 @@ import (
var Current *Schema

const (
Name = "elephp"
Name = "phpls"
Version = "0.0.1-dev"
SchemaLocation = "https://raw.githubusercontent.com/laytan/elephp/main/internal/config/elephp.schema.json"
SchemaLocation = "https://raw.githubusercontent.com/laytan/phpls/main/internal/config/phpls.schema.json"
ok = 0
err = 1
invalid = 2
)

// filenames are the files we check for in each of the directories that are checked.
var filenames = []string{
"./elephp.json",
"./.elephp.json",
"./elephp.yml",
"./.elephp.yml",
"./elephp.yaml",
"./.elephp.yaml",
"./phpls.json",
"./.phpls.json",
"./phpls.yml",
"./.phpls.yml",
"./phpls.yaml",
"./.phpls.yaml",
}

// Parse loads the configuration from all the config files, environment variables, cli flags, and defaults.
Expand Down Expand Up @@ -106,22 +106,22 @@ func wrapUsage(flags *flag.FlagSet) {
_, _ = fmt.Fprintf(
o,
`
ElePHP - The PHP language server
phpls - The PHP language server

Available commands:
default Runs the language server
logs Outputs the directory where logs are saved
stubs Outputs the directory where stubs are saved

The following file names are seen as ElePHP configuration files:
The following file names are seen as phpls configuration files:
%s
These files are recognized when they are in any of the following directories:
%s
These files are checked top to bottom, with later files overwriting the former.
See %s for the configuration schema.

Configuration files are then overwritten by environment variables, with the prefix 'ELEPHP_',
so setting the php version can for example be done with 'ELEPHP_PHP_VERSION=8'.
Configuration files are then overwritten by environment variables, with the prefix 'phpls_',
so setting the php version can for example be done with 'phpls_PHP_VERSION=8'.

`, files.String(), dirs.String(), SchemaLocation,
)
Expand All @@ -138,7 +138,7 @@ func loadConfig(args []string) *Schema {
// SkipFiles: false,
// SkipEnv: false,
// SkipFlags: false,
EnvPrefix: "ELEPHP",
EnvPrefix: "phpls",
// FlagPrefix: "",
FlagDelimiter: ".",
// AllFieldRequired: false,
Expand Down Expand Up @@ -252,7 +252,7 @@ func applyComputedDefaults(cfg *Schema) {
}

func setComputed(cfg *Schema) {
cfg.LogsPath = filepath.Join(cfg.CachePath, "elephp", Version, "logs")
cfg.LogsPath = filepath.Join(cfg.CachePath, "phpls", Version, "logs")
if err := os.MkdirAll(cfg.LogsPath, 0o755); err != nil {
_, _ = fmt.Fprintf(
os.Stderr,
Expand All @@ -263,7 +263,7 @@ func setComputed(cfg *Schema) {
os.Exit(invalid)
}

cfg.StubsPath = filepath.Join(cfg.CachePath, "elephp", Version, "stubs")
cfg.StubsPath = filepath.Join(cfg.CachePath, "phpls", Version, "stubs")
if err := os.MkdirAll(cfg.LogsPath, 0o755); err != nil {
_, _ = fmt.Fprintf(
os.Stderr,
Expand Down Expand Up @@ -303,7 +303,7 @@ func configDirs() (dirs []string) {
// configPaths collects all paths to check for config files.
func configPaths() (paths []string) {
for _, dir := range configDirs() {
paths = append(paths, addFileNames(filepath.Join(dir, "elephp"))...)
paths = append(paths, addFileNames(filepath.Join(dir, "phpls"))...)
}
paths = append(paths, filenames...)
return paths
Expand Down
10 changes: 5 additions & 5 deletions internal/config/config_gen.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build ignore
// +build ignore

// This code generates the elephp.schema.json and default_config.json files.
// This code generates the phpls.schema.json and default_config.json files.

package main

Expand All @@ -12,13 +12,13 @@ import (
"strings"

"github.com/danielgtaylor/huma/schema"
"github.com/laytan/elephp/internal/config"
"github.com/laytan/phpls/internal/config"
)

const (
SchemaVersion = "https://json-schema.org/draft/2020-12/schema"
Title = "ElePHP"
Description = "Configuration format for the ElePHP language server."
Title = "phpls"
Description = "Configuration format for the phpls language server."
)

type Schema struct {
Expand All @@ -40,7 +40,7 @@ func dumpSchema() {
panic(err)
}

fh, err := os.Create("elephp.schema.json")
fh, err := os.Create("phpls.schema.json")
if err != nil {
panic(err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/laytan/elephp/main/internal/config/elephp.schema.json",
"title": "ElePHP",
"description": "Configuration format for the ElePHP language server.",
"$id": "https://raw.githubusercontent.com/laytan/phpls/main/internal/config/phpls.schema.json",
"title": "phpls",
"description": "Configuration format for the phpls language server.",
"type": "object",
"properties": {
"cache_path": {
Expand Down
4 changes: 2 additions & 2 deletions internal/config/schema.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package config

import (
"github.com/laytan/elephp/pkg/connection"
"github.com/laytan/elephp/pkg/phpversion"
"github.com/laytan/phpls/pkg/connection"
"github.com/laytan/phpls/pkg/phpversion"
)

type DiagnosticsMethod string
Expand Down
8 changes: 4 additions & 4 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package context
import (
"fmt"

"github.com/laytan/elephp/internal/wrkspc"
"github.com/laytan/elephp/pkg/nodescopes"
"github.com/laytan/elephp/pkg/position"
"github.com/laytan/elephp/pkg/traversers"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/php-parser/pkg/token"
"github.com/laytan/php-parser/pkg/visitor/traverser"
"github.com/laytan/phpls/internal/wrkspc"
"github.com/laytan/phpls/pkg/nodescopes"
"github.com/laytan/phpls/pkg/position"
"github.com/laytan/phpls/pkg/traversers"
)

type Ctx struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"time"

"github.com/fsnotify/fsnotify"
"github.com/laytan/elephp/internal/config"
"github.com/laytan/elephp/pkg/set"
"github.com/laytan/go-lsp-protocol/pkg/lsp/protocol"
"github.com/laytan/phpls/internal/config"
"github.com/laytan/phpls/pkg/set"
)

// Implement closer to do clean up (stopping a daemon for example).
Expand Down Expand Up @@ -499,7 +499,7 @@ func timeDiagnostics(name string) func() {
// TODO: consistent casing and consistent ending . or not.
func normalizeDiagnostics(name string, diagnostics []protocol.Diagnostic) []protocol.Diagnostic {
for i := range diagnostics {
diagnostics[i].Source = "elephp-" + name
diagnostics[i].Source = "phpls-" + name
diagnostics[i].Message = fmt.Sprintf("[%s] %s", name, diagnostics[i].Message)
}

Expand Down
8 changes: 4 additions & 4 deletions internal/diagnostics/phpcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"fmt"
"log"

"github.com/laytan/elephp/internal/wrkspc"
"github.com/laytan/elephp/pkg/functional"
"github.com/laytan/elephp/pkg/phpcs"
"github.com/laytan/go-lsp-protocol/pkg/lsp/protocol"
"github.com/laytan/phpls/internal/wrkspc"
"github.com/laytan/phpls/pkg/functional"
"github.com/laytan/phpls/pkg/phpcs"
)

type PhpcsAnalyzer struct {
Expand Down Expand Up @@ -66,7 +66,7 @@ func phpcsMessageToDiagnostic(m *phpcs.ReportMessage) protocol.Diagnostic {
Range: protocol.Range{Start: pos, End: pos},
Severity: phpcsToLSPSeverity(m.Type),
Code: m.Source,
// Source: "elephp",
// Source: "phpls",
Message: m.Msg,

// TODO: check if message is for deprecation/unnecessary, and add tags accordingly.
Expand Down
6 changes: 3 additions & 3 deletions internal/diagnostics/phpstan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"fmt"
"log"

"github.com/laytan/elephp/pkg/functional"
"github.com/laytan/elephp/pkg/phpstan"
"github.com/laytan/go-lsp-protocol/pkg/lsp/protocol"
"github.com/laytan/phpls/pkg/functional"
"github.com/laytan/phpls/pkg/phpstan"
)

type PhpstanAnalyzer struct {
Expand Down Expand Up @@ -51,7 +51,7 @@ func phpstanMessageToDiagnostic(m *phpstan.ReportMessage) protocol.Diagnostic {
Severity: protocol.SeverityError,
// Code: nil,
// CodeDescription: &protocol.CodeDescription{},
// Source: "elephp:phpstan",
// Source: "phpls:phpstan",
Message: m.Msg,
// Tags: []protocol.DiagnosticTag{},
// RelatedInformation: []protocol.DiagnosticRelatedInformation{},
Expand Down
6 changes: 3 additions & 3 deletions internal/doxcontext/doxcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package doxcontext
import (
"strings"

"github.com/laytan/elephp/pkg/fqn"
"github.com/laytan/elephp/pkg/functional"
"github.com/laytan/elephp/pkg/phpdoxer"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/php-parser/pkg/position"
"github.com/laytan/phpls/pkg/fqn"
"github.com/laytan/phpls/pkg/functional"
"github.com/laytan/phpls/pkg/phpdoxer"
)

// ApplyContext applies any context we have about the code (which phpdoxer
Expand Down
8 changes: 4 additions & 4 deletions internal/expr/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package expr

import (
"appliedgo.net/what"
"github.com/laytan/elephp/pkg/fqn"
"github.com/laytan/elephp/pkg/phpdoxer"
"github.com/laytan/elephp/pkg/phprivacy"
"github.com/laytan/elephp/pkg/stack"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/php-parser/pkg/position"
"github.com/laytan/phpls/pkg/fqn"
"github.com/laytan/phpls/pkg/phpdoxer"
"github.com/laytan/phpls/pkg/phprivacy"
"github.com/laytan/phpls/pkg/stack"
)

type Type int
Expand Down
4 changes: 2 additions & 2 deletions internal/expr/expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"reflect"
"testing"

"github.com/laytan/elephp/internal/expr"
"github.com/laytan/elephp/pkg/stack"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/phpls/internal/expr"
"github.com/laytan/phpls/pkg/stack"
"go.uber.org/goleak"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/expr/privacy.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package expr

import (
"github.com/laytan/elephp/pkg/phprivacy"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/phpls/pkg/phprivacy"
)

// Context about the iteration for determining privacy.
Expand Down
12 changes: 6 additions & 6 deletions internal/expr/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"log"

"github.com/laytan/elephp/internal/index"
"github.com/laytan/elephp/internal/symbol"
"github.com/laytan/elephp/internal/wrkspc"
"github.com/laytan/elephp/pkg/fqn"
"github.com/laytan/elephp/pkg/nodeident"
"github.com/laytan/elephp/pkg/phprivacy"
"github.com/laytan/php-parser/pkg/ast"
"github.com/laytan/phpls/internal/index"
"github.com/laytan/phpls/internal/symbol"
"github.com/laytan/phpls/internal/wrkspc"
"github.com/laytan/phpls/pkg/fqn"
"github.com/laytan/phpls/pkg/nodeident"
"github.com/laytan/phpls/pkg/phprivacy"
)

var resolvers = map[Type]ClassResolver{
Expand Down
Loading