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

Go to Definition #45

Closed
Damanox opened this issue Jun 1, 2016 · 16 comments
Closed

Go to Definition #45

Damanox opened this issue Jun 1, 2016 · 16 comments
Labels

Comments

@Damanox
Copy link

Damanox commented Jun 1, 2016

Go to Definition sometimes does not work or move cursor to line or even file, that does not contains this variable.
OS: Windows 10 x64
Code-D: 0.10.10
Workspace-D: 2.7.1+commit.11.gc27329c
691f52bb05

@WebFreak001
Copy link
Member

It's because it's a template function and it can't know which function it should show you without you providing the arguments. If you click on it anyway without any arguments it should just open the file without knowing the exact function definition. When the file is open you can just press Ctrl-Shift-O (outline) and it will show you all functions in the file. You can then enter the function name you want to show the definition of in there.

If you want more features for go to definition, auto completion, documentation or similar things consider creating an issue on Hackerpilot/DCD first and I will make it work with code-d as quickly as possible once it's implemented

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

filename is not a function, it's a variable, screenshot doesn't show it, here is readConfig definition:
private bool readConfig(string filename, ref Config config)
Made a few tests, it seems that it's working properly for the lines at file start and glitches towards the end of file

@WebFreak001
Copy link
Member

Hm, does it work if its in the first line? If yes then its probably an issue with the line endings. Does it work if you change them to LF instead of CRLF in the bottom right? DCD isn't always working perfectly either. There is often a problem with auto variables and UFCS but it should work with the normal way of calling. Try making a small source file where you can easily reproduce the issue

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

Hm, does it work if its in the first line?

Yes
1d5c563f36

@WebFreak001
Copy link
Member

Does it still work with that variable if you copy that same code to the bottom of the file?

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

Changing line ending doesn't make difference
Forgot to say, but i made some changes to workspace-d code, replaced
line[0 .. $ - 1].split('t');
with
line.chomp().split('t');
because it throws error without this

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

Does it still work with that variable if you copy that same code to the bottom of the file?

Nope

@WebFreak001
Copy link
Member

Is there a delegate somewhere in the middle? DCD gets very unusable for code after delegates

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

Is there a delegate somewhere in the middle? DCD gets very unusable for code after delegates

Nope

@WebFreak001
Copy link
Member

Does it work in the console if you pass it to dcd-client?

@Damanox
Copy link
Author

Damanox commented Jun 1, 2016

Tested in console, works only if file has \r\n line ending
In Code-D does not works regardless of the line ending

@Damanox
Copy link
Author

Damanox commented Aug 11, 2016

Did some research on this bug and found the problem. document.offsetAt returns wrong offset if file contains non-ASCII symbols
Looks like it returns character offset, not byte offset
If I remove every non-ASCII symbol in my code everything works great

@WebFreak001
Copy link
Member

Hm now the question: is this DCD's fault for not handling unicode characters as one letter or is it because vscode handles them as multiple letters?

@Damanox
Copy link
Author

Damanox commented Aug 12, 2016

DCD requires byte offset, but vscode works with text, not with it's byte representation, for vscode every symbol length = 1, but non-ASCII symbols consists of 2 bytes, which creates incosistence between dcd and vscode
microsoft/vscode#5735

@WebFreak001
Copy link
Member

oh nice I will implement it then when they add it to the API and maybe add a workaround using the nodejs buffer api while they are doing this. Thanks for your research

@trikko
Copy link

trikko commented Sep 7, 2016

In italian unicode symbols are pretty common, so now I understand why this function never worked for me...

(Please notice: i'm using linux, this bug is tagged as "windows")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants