qiuxiang / coc-solidity

Solidity language server for coc.nvim
MIT License
48 stars 0 forks source link

Some limitations of new LS #4

Closed TortoiseHive closed 2 years ago

TortoiseHive commented 2 years ago

This new LS (solc) is good, but have some limitations:

new: image

old: image

It worth to keep this new LS?

qiuxiang commented 2 years ago

What is the declaration of juniorToken?

TortoiseHive commented 2 years ago

What is the declaration of juniorToken?

JuniorToken public juniorToken;

JuniorToken is a ERC20 contract.

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.7 <0.9.0;


import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract JuniorToken is ERC20 {
    constructor (string memory _name, string memory _symbol, uint256 _amount) ERC20(_name, _symbol) {
        _mint(msg.sender, _amount);
    }
}

Inside JuniorToken i can use the LSP image

qiuxiang commented 2 years ago

I got it. That's what I say the LS has no tolerance.

You need type juniorToken; first (to make syntax correct ), then type . after juniorToken. Just like:

I have to say this is a bit inconvenient. But I still decided to develop new lsp. Because official compiler is more reliable.

qiuxiang commented 2 years ago

This problem can resolve with error recovery. Although it is not easy to implement.

TortoiseHive commented 2 years ago

I got it. That's what I say the LS has no tolerance.

You need type juniorToken; first (to make syntax correct ), then type . after juniorToken. Just like:

I have to say this is a bit inconvenient. But I still decided to develop new lsp. Because official compiler is more reliable.

My JuniorToken already is ERC20, it have the ERC20 methods:

contract JuniorToken is ERC20 {

The LSP of coc-solidity@0.1.0 could detect the methods.

Just to be clear:

I have two files:

Lending and JuniorToken.

Lending have:

        juniorToken = new JuniorToken(string(abi.encodePacked(_tokenName, " jr")),
                                      string(abi.encodePacked("J", _tokenSymbol)), _juniorAmount);

the juniorToken already have a type, is a global variable of lending.

qiuxiang commented 2 years ago

u didn't get my point. I'm talking about syntax tolerance.

Completions not working because syntax error (missing semicolon).

Screenshot from 2022-03-25 12-37-09

Completions working

Screenshot from 2022-03-25 12-42-48

TortoiseHive commented 2 years ago

image

image

image

(im calling inside the lending)

even with ; i dont get the transfer in LS.

With coc-solidity@0.1.0 in same place:

image

qiuxiang commented 2 years ago

can you give me a demo project to reproduce this issue?

qiuxiang commented 2 years ago

just some minimal codes to reproduce this issue.

TortoiseHive commented 2 years ago

just some minimal codes to reproduce this issue.

Here:

https://github.com/TortoiseHive/test-coc-solidity

Use the contracts/Lending.sol to do the test.

Actual COC: image

0.1.0 (appears 3 times, its strange): image

qiuxiang commented 2 years ago

Screenshot from 2022-03-25 13-10-57

TortoiseHive commented 2 years ago

Screenshot from 2022-03-25 13-10-57

that awkward D:

Maybe something in my OS?

Can you test with my the config i use?

https://github.com/otavioschwanck/mood-nvim

My CocInfo:


## versions

vim version: NVIM v0.7.0-dev+1245-gf291a0339
node version: v14.18.1
coc.nvim version: 0.0.80-c9f7aa24 2022-03-24 23:11:36 +0800
coc.nvim directory: /Users/otavio/.local/share/nvim/site/pack/packer/start/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2022-03-25T02:17:44.439 INFO (pid:57233) [services] - registered service "languageserver.dls"
2022-03-25T02:17:44.522 INFO (pid:57233) [plugin] - coc.nvim initialized with node: v14.18.1 after 152ms
2022-03-25T02:17:46.429 INFO (pid:57233) [attach] - receive notification: highlight []
2022-03-25T02:17:54.536 INFO (pid:57233) [services] - registered service "solidity"
2022-03-25T02:17:54.537 INFO (pid:57233) [services] - Solidity Language Server state change: stopped => starting
2022-03-25T02:17:54.575 INFO (pid:57233) [core-watchman] - watchman watching project: /Users/otavio/demo-for-coc-solidity
2022-03-25T02:17:54.814 INFO (pid:57233) [attach] - receive notification: highlight []
2022-03-25T02:17:56.866 INFO (pid:57233) [attach] - receive notification: highlight []
2022-03-25T02:17:57.695 INFO (pid:57233) [attach] - receive notification: highlight []
2022-03-25T02:17:58.527 INFO (pid:57233) [services] - Solidity Language Server state change: starting => running
2022-03-25T02:17:58.528 INFO (pid:57233) [services] - service solidity started
2022-03-25T02:18:00.183 INFO (pid:57233) [attach] - receive notification: showInfo []

Did you use the same remapping that i ?

EDIT:

image

Is working now somehow (just in this demo project). On my main project it doesn't work. i will figure it out why tomorrow

qiuxiang commented 2 years ago

I think you still haven't got the point .

qiuxiang commented 2 years ago

The point is tolerance.

TortoiseHive commented 2 years ago

I think you still haven't got the point .

i got, i need the ;

TortoiseHive commented 2 years ago

I think you still haven't got the point .

I just pushed a new commit to the repository.

If some warning is present, this part stop working, probabily some error in LSP, not in coc.

EDIT:

Ignore, its not happening when i remove too. Dont know how to reproduce =/

qiuxiang commented 2 years ago

https://user-images.githubusercontent.com/1709072/160060689-8be9a4e2-3fba-44e9-88bd-18cf7a771a55.mp4

TortoiseHive commented 2 years ago

Demo video:

https://www.dropbox.com/s/ykfdod6tntq4s6f/Grava%C3%A7%C3%A3o%20de%20Tela%202022-03-25%20%C3%A0s%2002.45.23.mov?dl=0

its very random, sometimes works, sometimes not (most of time not)

qiuxiang commented 2 years ago

member completion trigger by ., so u need delete . first, and then type . again.

TortoiseHive commented 2 years ago

Got it, now is working.

TortoiseHive commented 2 years ago

image

Working perfectly <3 Super thanks!