BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.67k stars 217 forks source link

Namespace Form Auto-creation doesn't work in a certain project. #1540

Open jungwookim opened 2 years ago

jungwookim commented 2 years ago

Hi!

I'm having a few clojure project and ns auto creation doesn't work at one of projects. I couldn't get any reasons why.

bpringe commented 2 years ago

Thanks for reporting. If you can provide a project for which it doesn't work, in a linked repo, that would be helpful.

PEZ commented 2 years ago

Can you elaborate a bit on ”doesn't work”?

jungwookim commented 2 years ago

@bpringe That repo is private owned by the company.

When I create a my-file.clj file, the file is generated but ns isn't created. cc. @PEZ

bpringe commented 2 years ago

@jungwookim Can you reproduce the issue in a small sample project, unrelated to the company project?

I just tried to reproduce the issue in a few different projects with no luck.

bpringe commented 2 years ago

If you can copy and paste what shows in the logs between the client and server when you reproduce the issue, that might help: https://calva.io/clojure-lsp/#viewing-the-logs-between-the-client-and-server.

You can also check the server logs for any errors: https://calva.io/clojure-lsp/#opening-the-server-log-file.

jungwookim commented 2 years ago

@bpringe Thank you for letting me know the trouble shooting guides.

[Trace - 1:36:34 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj",
        "languageId": "clojure",
        "version": 1,
        "text": ""
    }
}

[Trace - 1:36:34 PM] Sending request 'textDocument/documentSymbol - (1135)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj"
    }
}

[Trace - 1:36:34 PM] Received response 'textDocument/documentSymbol - (1135)' in 11ms.
Result: [
    {
        "name": "/Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj",
        "kind": 21,
        "range": {
            "start": {
                "line": 0,
                "character": 0
            },
            "end": {
                "line": 999999,
                "character": 999999
            }
        },
        "selectionRange": {
            "start": {
                "line": 0,
                "character": 0
            },
            "end": {
                "line": 999999,
                "character": 999999
            }
        },
        "children": []
    }
]

[Trace - 1:36:34 PM] Sending request 'textDocument/semanticTokens/full - (1136)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj"
    }
}

[Trace - 1:36:34 PM] Received response 'textDocument/semanticTokens/full - (1136)' in 2ms.
Result: {
    "data": []
}

[Trace - 1:36:34 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj",
    "diagnostics": []
}

[Trace - 1:36:34 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/auto_creation.clj",
            "type": 1
        }
    ]
}

[Trace - 1:37:01 PM] Sending request 'textDocument/definition - (1137)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/jungwookim/Documents/GitHub/sinsun-market/server/.calva/output-window/output.calva-repl"
    },
    "position": {
        "line": 1,
        "character": 48
    }
}

[Trace - 1:37:01 PM] Received response 'textDocument/definition - (1137)' in 2ms.
No result returned.

[Trace - 1:37:04 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "git:/Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/mock_sql.clj?%7B%22path%22%3A%22%2FUsers%2Fjungwookim%2FDocuments%2FGitHub%2Fsinsun-market%2Fserver%2Ftest%2Ffarmmorning_bridge%2Fmock_sql.clj%22%2C%22ref%22%3A%22~%22%7D",
            "type": 2
        }
    ]
}

[Trace - 1:40:05 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "git:/Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/mock_sql.clj?%7B%22path%22%3A%22%2FUsers%2Fjungwookim%2FDocuments%2FGitHub%2Fsinsun-market%2Fserver%2Ftest%2Ffarmmorning_bridge%2Fmock_sql.clj%22%2C%22ref%22%3A%22~%22%7D",
            "type": 2
        }
    ]
}

[Trace - 1:40:07 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "git:/Users/jungwookim/Documents/GitHub/sinsun-market/server/test/farmmorning_bridge/mock_sql.clj?%7B%22path%22%3A%22%2FUsers%2Fjungwookim%2FDocuments%2FGitHub%2Fsinsun-market%2Fserver%2Ftest%2Ffarmmorning_bridge%2Fmock_sql.clj%22%2C%22ref%22%3A%22~%22%7D",
            "type": 2
        }
    ]
}

This is logs between the client and server. I compared the above logs and successful logs located in another project and I found out Received request 'workspace/applyEdit '. was missing here. 🤔

bpringe commented 2 years ago

Yes, indeed that does seem to be the case. Are you using the latest version of clojure-lsp?

@ericdallo Do you see anything that stands out here?

ericdallo commented 2 years ago

That's likely to be a wrongly configured or not configured source-paths, for most projects clojure-lsp finds it automatically, but for some lein mono-repos it's needed to configure it properly, check https://clojure-lsp.io/settings/#source-paths-discovery

The good news are that next release, should change how that works to consider source-paths from classpath, not something clojure-lsp would need to do manually like we do ATM