Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gnome-builder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Günther Wagner
gnome-builder
Commits
bef094f8
Commit
bef094f8
authored
May 10, 2020
by
Günther Wagner
Committed by
Christian Hergert
May 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added formatter and possibility to trigger a full format from vim
parent
1d11a736
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
2 deletions
+98
-2
src/libide/lsp/ide-lsp-formatter.c
src/libide/lsp/ide-lsp-formatter.c
+1
-1
src/plugins/rust-analyzer/meson.build
src/plugins/rust-analyzer/meson.build
+1
-0
src/plugins/rust-analyzer/rust-analyzer-formatter.c
src/plugins/rust-analyzer/rust-analyzer-formatter.c
+59
-0
src/plugins/rust-analyzer/rust-analyzer-formatter.h
src/plugins/rust-analyzer/rust-analyzer-formatter.h
+31
-0
src/plugins/rust-analyzer/rust-analyzer.c
src/plugins/rust-analyzer/rust-analyzer.c
+4
-0
src/plugins/rust-analyzer/rust-analyzer.plugin
src/plugins/rust-analyzer/rust-analyzer.plugin
+1
-1
src/plugins/vim/keybindings/vim.css
src/plugins/vim/keybindings/vim.css
+1
-0
No files found.
src/libide/lsp/ide-lsp-formatter.c
View file @
bef094f8
...
...
@@ -356,7 +356,7 @@ ide_lsp_formatter_format_range_async (IdeFormatter *formatter,
g_assert
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
ide_task_new
(
self
,
cancellable
,
callback
,
user_data
);
ide_task_set_source_tag
(
task
,
ide_lsp_formatter_format_async
);
ide_task_set_source_tag
(
task
,
ide_lsp_formatter_format_
range_
async
);
ide_task_set_task_data
(
task
,
g_object_ref
(
buffer
),
g_object_unref
);
if
(
gtk_text_iter_compare
(
begin
,
end
)
>
0
)
...
...
src/plugins/rust-analyzer/meson.build
View file @
bef094f8
...
...
@@ -6,6 +6,7 @@ plugins_sources += files([
'rust-analyzer-completion-provider.c',
'rust-analyzer-symbol-resolver.c',
'rust-analyzer-diagnostic-provider.c',
'rust-analyzer-formatter.c',
'rust-analyzer-transfer.c',
'rust-analyzer-workbench-addin.c',
])
...
...
src/plugins/rust-analyzer/rust-analyzer-formatter.c
0 → 100644
View file @
bef094f8
/* rust-analyzer-formatter.c
*
* Copyright 2020 Günther Wagner <info@gunibert.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "rust-analyzer-formatter.h"
#include "rust-analyzer-service.h"
struct
_RustAnalyzerFormatter
{
IdeLspFormatter
parent_instance
;
};
static
void
provider_iface_init
(
IdeFormatterInterface
*
iface
);
G_DEFINE_TYPE_WITH_CODE
(
RustAnalyzerFormatter
,
rust_analyzer_formatter
,
IDE_TYPE_LSP_FORMATTER
,
G_IMPLEMENT_INTERFACE
(
IDE_TYPE_FORMATTER
,
provider_iface_init
))
static
void
rust_analyzer_formatter_class_init
(
RustAnalyzerFormatterClass
*
klass
)
{
}
static
void
rust_analyzer_formatter_init
(
RustAnalyzerFormatter
*
self
)
{
}
static
void
rust_analyzer_formatter_load
(
IdeFormatter
*
self
)
{
IdeContext
*
context
=
ide_object_get_context
(
IDE_OBJECT
(
self
));
RustAnalyzerService
*
service
=
ide_object_ensure_child_typed
(
IDE_OBJECT
(
context
),
RUST_TYPE_ANALYZER_SERVICE
);
g_object_bind_property
(
service
,
"client"
,
self
,
"client"
,
G_BINDING_SYNC_CREATE
);
rust_analyzer_service_ensure_started
(
service
);
}
static
void
provider_iface_init
(
IdeFormatterInterface
*
iface
)
{
iface
->
load
=
rust_analyzer_formatter_load
;
}
src/plugins/rust-analyzer/rust-analyzer-formatter.h
0 → 100644
View file @
bef094f8
/* rust-analyzer-formatter.h
*
* Copyright 2020 Günther Wagner <info@gunibert.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <libide-lsp.h>
G_BEGIN_DECLS
#define RUST_TYPE_ANALYZER_FORMATTER (rust_analyzer_formatter_get_type())
G_DECLARE_FINAL_TYPE
(
RustAnalyzerFormatter
,
rust_analyzer_formatter
,
RUST
,
ANALYZER_FORMATTER
,
IdeLspFormatter
)
G_END_DECLS
src/plugins/rust-analyzer/rust-analyzer.c
View file @
bef094f8
...
...
@@ -24,6 +24,7 @@
#include "rust-analyzer-completion-provider.h"
#include "rust-analyzer-symbol-resolver.h"
#include "rust-analyzer-diagnostic-provider.h"
#include "rust-analyzer-formatter.h"
#include "rust-analyzer-workbench-addin.h"
_IDE_EXTERN
void
...
...
@@ -41,4 +42,7 @@ _rust_analyzer_register_types (PeasObjectModule *module)
peas_object_module_register_extension_type
(
module
,
IDE_TYPE_DIAGNOSTIC_PROVIDER
,
RUST_TYPE_ANALYZER_DIAGNOSTIC_PROVIDER
);
peas_object_module_register_extension_type
(
module
,
IDE_TYPE_FORMATTER
,
RUST_TYPE_ANALYZER_FORMATTER
);
}
src/plugins/rust-analyzer/rust-analyzer.plugin
View file @
bef094f8
...
...
@@ -9,7 +9,7 @@ Name=Rust Analyzer Language Server Integration
X-Completion-Provider-Languages=rust
X-Diagnostic-Provider-Languages=rust
X-Symbol-Resolver-Languages=rust
#
X-Formatter-Languages=rust
X-Formatter-Languages=rust
#X-Highlighter-Languages=rust
#X-Hover-Provider-Languages=rust
#X-Rename-Provider-Languages=rust
src/plugins/vim/keybindings/vim.css
View file @
bef094f8
...
...
@@ -1725,6 +1725,7 @@
/* cycle "tabs" */
bind "<shift>t" { "action" ("frame", "previous-page", "") };
bind "t" { "action" ("frame", "next-page", "") };
bind "q" { "format-selection" () };
}
@binding-set builder-vim-source-view-normal-g-u
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment