Comments (10)
What are the units on the column number? Are they code points or code units?
from dcd.
According to the Kdevelop guys it's measured in 16bit characters (UTF-16), so calling toUTF16 on the line and looking up the "column" character should work.
from dcd.
UTF-16 code points can take up 32 bytes. You meant code units, right?
from dcd.
From what I found out it uses QString
which is supposed to handle unicode correctly, also from my testings it looked like it would tell the position in code points, rather than code units.
from dcd.
The lexer used by DCD only operates on UTF-8 text and then only stores byte offsets in its tokens. I used an optimization that relies on the fact that all keywords, operators and quote characters in D fit into a single byte. The lexer avoids using char[] as much as possible, and instead types everything as byte[] to avoid accidentally triggering any Phobos functions that perform decoding. If I wanted to store column numbers in code units the lexer would be much, much slower.
I think that it would make more sense to calculate a byte column number inside of your editor plugin before passing this column number to DCD.
from dcd.
The token structure is defined and documented here: https://github.com/Hackerpilot/Dscanner/blob/master/stdx/d/lexer.d#L129
from dcd.
I see, I thought it was some kind of combination of "dscanner" and the server, but this way it makes more sense. So I have to calculate the "byte length" for every line and sum it up, let's see if I can come up with something.
Can I pass the line and column (in a byte offset) to the server? The struct looks like it could work, that would simplify that a bit and definitly be more efficient.
from dcd.
Adding a column and line option to the client with corresponding changes to the message struct and the server would be fairly easy.
The server does cursor to token translation here. You should be able to enhance it to pass a function that compares the line and column numbers to lowerBound.
from dcd.
Can't you add support for Line:Column support in the Client? This would require the client to actually read the file, but I think that is not too bad.
from dcd.
Given that
a) Many editor plugins have been implemented without this feature
b) it would add complexity to the client and server code
I'm going to close this.
from dcd.
Related Issues (20)
- only autocomplete types inside AA type definition
- Custom object.d should be included by default
- Fail to build from source HOT 3
- dmd 2.101: none of the overloads of `fatalHandler` are callable using a `shared` object HOT 2
- Support `imported!"module".T`
- no compleltion with auto HOT 4
- MacPorts build is broken HOT 8
- No completion when mixing auto with symbols that references types bellow the cursor HOT 2
- DUB build of ~master broken on Appveyor HOT 1
- Get rid of deprecate warnings
- An idea to resolve usages of auto as return type and alias as parameters HOT 1
- UFCS regression on master
- No completion for eponymous alias template HOT 1
- UFCS not matching class inheritance
- Differentiate UFCS functions from regular fields HOT 2
- Add option to disable UFCS completion
- Missing named arguments implementation HOT 1
- Implement `FunctionCallExpression` HOT 1
- Handle ``package`` access visibility
- dcd-client brings down server when querying for documentation of modules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dcd.