Comments (14)
If you use this
(add-to-list
'aggressive-indent-dont-indent-if
'(and (derived-mode-p 'c++-mode)
(null (string-match "\\([;{}]\\|\\b\\(if\\|for\\|while\\)\\b\\)"
(thing-at-point 'line)))))
Does it still happen?
from emacs-ccls.
The problem isn't there anymore but aggressive-indent-mode doesn't do anything either. Even if my buffer doesn't match the regex (which is hard to create because it looks like it will match anything that has parens, ifs, etc).
from emacs-ccls.
It works fine for me. Are you sure that the problem is not something else?
from emacs-ccls.
I just tried my minimal config above together with your suggestion and the problem is still there (text is still deleted). I think I forgot to enable aggresive-indent in my last reply. I used this c++ sample file
#include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}
from emacs-ccls.
What emacs version are you running ?Also can you check if company is activated before or after aggressive-indent ?
from emacs-ccls.
I'm running the latest stable arch linux build of emacs: GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
The minimal config in op didn't have company installed, but i tried adding
(straight-use-package 'company)
(global-company-mode)
to it with the same results as my last post
from emacs-ccls.
Instead of
(global-aggressive-indent-mode)
can you try hooking up aggressive-indent-mode on c-mode-hook and c++-mode-hook?
from emacs-ccls.
That seems to make it more stable, but text is still randomly deleted if you press delete in this situation
code
|int var = 10;
code
| = cursor
from emacs-ccls.
OK at least we improved something, another concern i have is that Maskray has configured ccls in wiki using 3 different hooks from you.
:hook ((c-mode c++-mode objc-mode) .
(lambda () (require 'ccls) (lsp)))
Can you remove from your config
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(add-hook 'objc-mode-hook 'lsp)
and replace it with the equivalent code of straight.el-use-package based on the code i mentioned above?
from emacs-ccls.
That's the same as
(add-hook 'c-mode-hook '(lambda () (require 'ccls) (lsp)))
(add-hook 'c++-mode-hook '(lambda () (require 'ccls) (lsp)))
(add-hook 'objc-mode-hook '(lambda () (require 'ccls) (lsp)))
which has the same problem
from emacs-ccls.
I am not sure but c-mode and c-mode-hook are not the same.
The equivalent to what i said is.
(add-hook 'c-mode '(lambda () (require 'ccls) (lsp)))
(add-hook 'c++-mode '(lambda () (require 'ccls) (lsp)))
(add-hook 'objc-mode '(lambda () (require 'ccls) (lsp)))
from emacs-ccls.
No, every mode has a hook that is run when it is enabled, so what :hook ((c-mode c++-mode objc-mode) .
does is that it takes the hooks of those modes and runs whatever is after the dot when those hooks are run
What's written after (add-hook 'c-mode
never executes because c-mode is just a function that inits the c-mode, not a hook
from emacs-ccls.
(setq lsp-enable-indentation nil)
(setq lsp-enable-on-type-formatting nil)
seemed to fix it for me
from emacs-ccls.
I can confirm the solution proposed from @0x00539 works.
from emacs-ccls.
Related Issues (20)
- c++17, std::optional HOT 1
- Header files not found with emacs-ccls, but works fine at vscode. HOT 1
- imenu: show static member variable instead of function
- Help wanted with configuration: C++ headers not found HOT 1
- conditional highlights doesn't work HOT 2
- Is there a way to manually suspend/resume ccls indexing?
- ccls stuck in "starting"
- Cannot find the references via ccls.xref HOT 2
- Open all hierachy tree at once
- Customize initialization options in S-exp has no effect HOT 1
- Multi-root project setup HOT 2
- Compilation warnings (as of 29.3)
- Using function prototypes auto-completion has strange behavior
- (void-function lsp:ccls-semantic-highlight-symbol-ranges). HOT 11
- use eval-and-compile instead of eval-when-compile HOT 1
- Function definition lsp:ccls-call-children is void HOT 3
- imenu not showing symbol types HOT 3
- Help with .ccls file config: Header file correctly parsed but "file not found" error appears.
- can not jump to std definition
- How to prevent buffers *ccls-tree call/inheritance hierarchy to use same window than buffer Treemacs ?
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 emacs-ccls.