Comments (4)
It is possible to disable the code lens feature by setting "editor.codeLens": false
in the editor preferences. That will turn the feature off for the entire editor. I could probably add a separate option just for this extension and maybe have a command to toggle it on or off.
I'm not really sure how to adapt it so that it can be enabled or disabled locally though. Do you mean local to a compilation unit (file) or to a module or something else? Can you give me an example of where you would want to use that?
from vscode-reasonml.
from vscode-reasonml.
I see what you mean. I agree that the code lens feature is a little bit too noisy in some cases like with a lot of simple top level bindings.
I will add a separate option to allow disabling the code lens just for this extension.
Other than that, probably the best way to handle this would be to store a "code lens enabled/disabled" setting in the LokiJS database which I am currently just using for symbol-related metadata. That way you could remember the code lens setting on a per file basis. That data could also be persisted across editor sessions if it's in a database. I don't currently write the db to file but this might be a reason to start doing that.
If you wanted to try to add a setting to allow disabling this feature just for this extension, you would first need to add a new property like here. Next, in the code lens function here you would need to do a check for that setting (see session.settings
). Doing this shouldn't be hard. Integrating with the database like I described above would take more work.
from vscode-reasonml.
I've been thinking about this more and I believe it might be possible to change how the code lens works so that it can be disabled on a per-item basis. I think I would find that preferable to just disabling it for an entire file since I tend to use a lot of nested and/or recursive modules in my projects.
To facilitate this, we would need to make the hypothetical code-lens-toggle command take an optional range parameter. We would then use merlin to fit that range to an item (e.g., a module
or let
), and store a isCodeLensEnabled
property in the database (which would default to the global code lens preference if unset). When we refresh and submit the code lens data to the editor, we would filter out all the items that should be ignored. We could also have some sort of indicator like a gutter icon so that the user knows the code lens is locally disabled for that region.
Doing this would certainly add complexity to the code lens functionality but for the most part I think it would be straightforward to support. The main downside is that this idea makes some of the optimizations I had planned for the code lens functionality (caching, etc.) more difficult to implement. But performance doesn't seem to be a real problem at the moment anyway so that's probably okay.
from vscode-reasonml.
Related Issues (20)
- Error starting reason-vscode "expected string", fix error message for invalid bsconfig.json HOT 1
- Options for ReasonML formatting?
- BSC.exe: Wrong Argument. -bs-jsx expects an integer HOT 4
- Incorrect problem matcher for ocaml >= 4.09
- Wrong module for "go to definition" HOT 3
- merlin error reporting can be excessive
- [Feature] Completion on labelled arguments
- Unable to run first ocaml "hello world" program.
- Double error/warning dislayed
- WSL: opam local switch environment
- What does this highlighting of a whole function mean?
- Ternary Operators are Highlighted as bool
- Restart Merlin? HOT 1
- Why is the highlighting for OCaml so weird?
- Node module errors preventing extension from working
- Autocomplete not working HOT 1
- OCaml: Incorrect syntax highligthing if identifier starts with let
- Request textDocument/formatting failed
- VS Code: we have marked your extension as deprecated HOT 3
- Hijacking Markdown code block highlighting
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 vscode-reasonml.