Skip to content

Commit

Permalink
Merge branch 'aitopty'
Browse files Browse the repository at this point in the history
  • Loading branch information
wellcomez committed Nov 11, 2024
2 parents 161dde6 + a9d2ec0 commit d9d1331
Show file tree
Hide file tree
Showing 34 changed files with 879 additions and 459 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "pkg/tree-sitter-toml"]
path = pkg/tree-sitter-toml
url = [email protected]:tree-sitter-grammars/tree-sitter-toml.git
[submodule "pkg/aiopty"]
path = pkg/aiopty
url = [email protected]:wellcomez/aiopty.git
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"program": "${workspaceFolder}/main.go",
"console": "externalTerminal",
"args": [
"-gui",
"--gui",
]
},
{
Expand Down
15 changes: 9 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ if [[ -n $mac ]]; then
build_os
fi
if [[ -n $win ]]; then
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# For just the 64-bit compiler
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
# For just the 32-bit compiler
sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686
sss=$(which x86_64-w64-mingw32-gcc)
if [[ -z $sss ]];then
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# For just the 64-bit compiler
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
# For just the 32-bit compiler
sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686
fi
# sudo apt-get install x86_64-w64-mingw32-g++
build_win_x64
fi
Expand Down
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ replace github.com/tree-sitter/tree-sitter-markdown => ./pkg/tree-sitter-markdow
replace github.com/tree-sitter-grammars/tree-sitter-yaml => ./pkg/tree-sitter-yaml/bindings/go

replace github.com/tree-sitter-grammars/tree-sitter-toml => ./pkg/tree-sitter-toml/bindings/go

replace github.com/creack/pty => ./pkg/photostorm/pty

replace "github.com/iyzyi/aiopty" => ./pkg/aiopty


require (
github.com/charlievieth/fastwalk v1.0.8
github.com/reinhrst/fzf-lib v0.9.0
Expand Down Expand Up @@ -66,6 +71,7 @@ require (

require (
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/iyzyi/aiopty v0.1.0 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/iyzyi/aiopty v0.1.0 h1:T8PO7GqzltHTtm4/9W5Hx8sch5ZcHfuZqLIhAswnayg=
github.com/iyzyi/aiopty v0.1.0/go.mod h1:YHbYjp8WaPzwQc1W2yGSkwsjZ78UUL0735gJmsoKiWg=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
Expand Down
1 change: 1 addition & 0 deletions pkg/aiopty
Submodule aiopty added at afbcf1
2 changes: 1 addition & 1 deletion pkg/femto
Submodule femto updated 1 files
+5 −5 actions.go
5 changes: 2 additions & 3 deletions pkg/lsp/callin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
// "log"
"os"
"path/filepath"
"strings"
"time"

// "log"
// "strings"

"github.com/tectiv3/go-lsp"
Expand Down Expand Up @@ -231,7 +230,7 @@ func NewCallInTask(loc lsp.Location, lsp lspclient, level int) *CallInTask {
if body, err := NewBody(loc); err == nil {
name = body.String()
} else {
log.Println(err)
debug.DebugLog(DebugTag,err)
}
callstack_task_id++
task := &CallInTask{
Expand Down
13 changes: 7 additions & 6 deletions pkg/lsp/lspcore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"io"
"log"
// "log"
"os"
"os/exec"
"strings"
Expand All @@ -28,7 +28,7 @@ type rpchandle struct {

// Handle implements jsonrpc2.Handler.
func (r rpchandle) Handle(ctx context.Context, con *jsonrpc2.Conn, req *jsonrpc2.Request) {
log.Println(con, req)
debug.TraceLog(DebugTag, con, req)
// panic("unimplemented")
}

Expand Down Expand Up @@ -812,14 +812,14 @@ func mainxx2() {
cmd := exec.Command("clangd", "--log=verbose")
stdin, err := cmd.StdinPipe()
if err != nil {
log.Fatal(err)
debug.ErrorLog(DebugTag, err)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
log.Fatal(err)
debug.ErrorLog(DebugTag, err)
}
if err := cmd.Start(); err != nil {
log.Fatal(err)
debug.ErrorLog(DebugTag, err)
}
rwc := struct {
io.Reader
Expand Down Expand Up @@ -864,7 +864,8 @@ func mainxx2() {
InitializationOptions: initializationOptions,
Capabilities: capabilities,
}, &result); err != nil {
log.Fatal(err)
debug.ErrorLog(DebugTag, err)
return
}

debug.DebugLogf("clangd initialized: %+v %+v\n", result.ServerInfo.Name, result.ServerInfo.Version)
Expand Down
2 changes: 1 addition & 1 deletion pkg/lsp/lspcore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
// "fmt"
"context"
"fmt"
"log"
// "log"
"os/exec"
"path/filepath"
"testing"
Expand Down
6 changes: 4 additions & 2 deletions pkg/lsp/planuml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package lspcore

import (
"fmt"
"log"
// "log"
"os"
"os/exec"
"path/filepath"
"strings"

"zen108.com/lspvi/pkg/debug"
)

type PlanUmlBin struct {
Expand All @@ -24,7 +26,7 @@ func NewPlanUmlBin() (*PlanUmlBin, error) {
filepath.Dir(exec), jarPath)
javaCmd := findJavaBinary()
if _, err := os.Stat(jarPath); os.IsNotExist(err) {
log.Println(err)
debug.DebugLog(DebugTag, err)
return nil, err
}
return &PlanUmlBin{jarPath: jarPath, javaCmd: javaCmd}, nil
Expand Down
11 changes: 10 additions & 1 deletion pkg/lsp/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"

"github.com/tectiv3/go-lsp"
"zen108.com/lspvi/pkg/debug"
)

Expand All @@ -15,6 +16,11 @@ type snippet_arg struct {
capture string
pos int
}

func (a CompleteCodeLine) InRange(x int) bool {
return x > a.start.Character
}

type complete_token struct {
arg snippet_arg
Text string
Expand All @@ -31,6 +37,7 @@ type CompleteCodeLine struct {
snip snippet
snip_args []snippet_arg
tokens []complete_token
start lsp.Position
}
type snippet struct {
raw string
Expand Down Expand Up @@ -79,7 +86,8 @@ func (code CompleteCodeLine) Text() string {
}
return strings.Join(ret, "")
}
func NewCompleteCode(raw string) (ret *CompleteCodeLine) {
func NewCompleteCode(edit *lsp.TextEdit) (ret *CompleteCodeLine) {
var raw string = edit.NewText
ret = &CompleteCodeLine{snip: snippet{raw: raw}}
ret.snip_args = ret.snip.args()
tokens := []complete_token{}
Expand Down Expand Up @@ -108,6 +116,7 @@ func NewCompleteCode(raw string) (ret *CompleteCodeLine) {
} else {
tokens = append(tokens, ret.string_to_token(s)...)
}
ret.start = edit.Range.Start
ret.tokens = tokens
return
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/lsp/uml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package lspcore

import (
"fmt"
"log"
// "log"
"strings"

"github.com/tectiv3/go-lsp"
"zen108.com/lspvi/pkg/debug"
)

// 假设以下类型和函数已经被定义:
Expand Down Expand Up @@ -108,7 +109,7 @@ func (call CallStack) olduml() ([]string, string) {
}
right := rightPrefix + s.symboldefine_name()
if strings.Index(right, "ProcessInternal") > 0 {
log.Println(right, s.symboldefine_name(), s.uml_class_name())
debug.TraceLog(DebugTag, right, s.symboldefine_name(), s.uml_class_name())
}
if len(ret) == 0 {
title = fmt.Sprintf("==%s==", right)
Expand Down
Loading

0 comments on commit d9d1331

Please sign in to comment.