text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|> };
// 任务监听器2
JobExecutionListener jobExecutionListenerTwo = new JobExecutionListener() {
@Override
public void beforeJob(JobExecution jobExecution) {
System.out.println("任务监听器Two,before job execute: " + jobExecution.getJobInstance().getJobName());
... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ProcessListener)
.writer(list -> list.forEach(System.out::println))
.listener(myItemWriterListener)
.build();
}
private ItemReader<String> reader() {
List<String> data = Arrays.asList("java", "c++", "javascript", "python");
return ne... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.batch.listener;
import org.springframework.batch.core.ChunkListener;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.stereotype.Component;
/**
* @author MrBird
*/
@Component
public class MyChunkListener implements ChunkListener {
@Over... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.batch.listener;
import org.springframework.batch.core.ItemProcessListener;
import org.springframework.stereotype.Component;
/**
* @author MrBird
*/
@Component
public class My<|fim_suffix|> public void beforeProcess(String item) {
System.out.println("before process: " + item);... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>before read");
}
@Override
public void afterRead(String item) {
System.out.println("after read: " + item);
}
@Override
public void onReadError(Exception ex) {
System.out.println("on read error: " + ex.getMessage());
}
}
<|fim_prefix|>package cc.mrbird.batch.li... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>
public void beforeWrite(List<? extends String> items) {
System.out.println("before write: " + items);
}
@Override
public void afterWrite(List<? extends String> items) {
System.out.println("after write: " + items);
}
@Override
public void onWriteError(Exceptio... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.batch.listener;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.stereotype.Component;
/**
* @author MrBird
*/
@Component
public class MyJobExecutionListener implements JobExecutionListener {
... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|> System.out.println("before step execute: " + stepExecution.getStepName());
}
@AfterStep
public void afterStep(StepExecution stepExecution) {
System.out.println("after step execute: " + stepExecution.getStepName());
}
}
<|fim_prefix|>package cc.mrbird.batch.listener;
import org... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>n
@EnableBatchProcessing
public class SpringBatchExceptionApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBatchExceptionApplication.class, args);
}
}
<|fim_prefix|>package cc.mrbird.batch;
import org.springframework.batch.core.configura<|fim_middle|>ti... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|> long serialVersionUID = 7168487913507656106L;
public MyJobExecutionException(String message) {
super(message);
}
}
<|fim_prefix|>package cc.mrbird.batch.exception;
/**
* @author MrBird
*/
public class MyJ<|fim_middle|>obExecutionException extends Exception{
private static final<... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ionContext.put("success", true);
throw new RuntimeException(errorMessage);
}
}).build()
).build();
}
}
<|fim_prefix|>package cc.mrbird.batch.job;
import org.springframework.batch.core.Job;
import org.... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ed
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Job restartJob() {
return jobBuilderFactory.get("restartJob")
.start(step())
.build();
}
private Step step() {
... | fim | wuyouzhuguli/SpringAll | java |
package cc.mrbird.batch.job;
import cc.mrbird.batch.exception.MyJobExecutionException;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.batch.job;
import cc.mrbird.batch.exception.MyJobExecutionException;
import cc.mrbird.batch.listener.MySkipListener;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
i... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>
@Component
public class TransactionJobDemo {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Job transactionJob() {
return jobBuilderFactory.get("transactionJob")
.start(step()... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>m + ",异常:" + t.getMessage());
}
}
<|fim_prefix|>package cc.mrbird.batch.listener;
import org.springframework.batch.core.SkipListener;
import org.springframework.stereotype.Component;
/**
* @author MrBird
<|fim_middle|> */
@Component
public class MySkipListener implements SkipListener<String, String... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.batch;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplic<|fim_suffix|>on
@EnableBatchProcessing
public class Spr... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>tryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
postProcessor.setJobRegistry(jobRegistry);
postProcessor.setBeanFactory(applicationContext.getAutowireCapableBeanFactory());
return postProcessor;
}
}
<|fim_prefix|>package cc.mrbird.batch.configure;
impo... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|> }
@GetMapping("operator/{message}")
public String operator(@PathVariable String message) throws Exception {
// 传递任务名称,参数使用 kv方式
jobOperator.start("job", "message=" + message);
return "success";
}
}
<|fim_prefix|>package cc.mrbird.batch.controller;
import org.sprin... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ent;
import java.util.Map;
/**
* @author MrBird
*/
@Component
public class MyJob{
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Job job(){
return jobBuilderFactory.get("job")
... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.consu<|fim_suffix|>ork.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
}
<|fim_middle|>mer;
import org.springframework... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.consumer.configure;
import org.springframework.context.annotation.Bean;
import <|fim_suffix|>tTemplate();
}
}
<|fim_middle|>org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* @author MrBird
*/
@Configuration
public clas... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>th, String.class);
return String.format("%s from %s %s", result, serviceInstance.getHost(), serviceInstance.getPort());
}
}
<|fim_prefix|>packag<|fim_middle|>e cc.mrbird.consumer.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>Application;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProviderApplication {
public static void main(String[] args) {
SpringApplication.run(ProviderApplication.class, args);
}
}
<|fim_prefix|>package cc.mrbird.provider;
<|fi... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>String message) {
return String.format("hello %s", message);
}
}
<|fim_prefix|>package cc.mrbird.provider.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestM... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.nacos;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Spring<|fim_suffix|>libabaNacosConfigApplication {
public static void main(String[] args) {
SpringApplication.... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>g message;
@Value("${ext1:null}")
private String ext1;
@Value("${ext2:null}")
private String ext2;
@GetMapping("message")
public String getMessage() {
return this.message;
}
@GetMapping("multi")
public String multiConfig() {
return String.format("ext1:... | fim | wuyouzhuguli/SpringAll | java |
package cc.mrbird.socket;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootWebsocketSocketjsApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootWebsocket... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.socket.configure;
import cc.mrbird.socket.handler.MyStringWebSocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.spr... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.socket.hand<|fim_suffix|>e static String fakeAi(String input) {
if (input == null || "".equals(input)) {
return "你说什么?没听清︎";
}
return input.replace('你', '我')
.replace("吗", "")
.replace('?', '!')
.replace(... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.sentinel;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringCloudAlibabaSentinelFlowControlApplication {
<|fim_suffix|>ingApplication.run(SpringCloudAlibabaSentinelFlowContr... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ate HelloService helloService;
@GetMapping("test1")
public String test1() {
throw new RuntimeException("服务异常");
// return "test1";
}
@GetMapping("test2")
public String test2() {
return "test2 " + helloService.hello();
}
@GetMapping("buy")
@Sentine... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>ngframework.stereotype.Service;
/**
* @author MrBird
*/
@Service
public class HelloService {
@SentinelResource("hello")
public String hello() {
return "hello";
}
}
<|fim_prefix|>pa<|fim_middle|>ckage cc.mrbird.sentinel.service;
import com.alibaba.csp.sentinel.annotation.SentinelRe... | fim | wuyouzhuguli/SpringAll | java |
<|fim_prefix|>package cc.mrbird.consumer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.spri<|fim_suffix|>ion.run(ConsumerApplication.class, args);
}
@Bean
... | fim | wuyouzhuguli/SpringAll | java |
<|fim_suffix|>plication
public class ProviderApplication {
public static void main(String[] args) {
SpringApplication.run(ProviderApplication.class, args);
}
}
<|fim_prefix|>package cc.mrbird.provider;
im<|fim_middle|>port org.springframework.boot.SpringApplication;
import org.springframework.boot.au... | fim | wuyouzhuguli/SpringAll | java |
using System.Windows;
namespace OFGB
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
<|endoftext|> | fim | xM4ddy/OFGB | csharp |
<|fim_suffix|>ocation.SourceAssembly
)]
<|fim_prefix|>using System.Windows;
[assembly: ThemeInfo(
ResourceD<|fim_middle|>ictionaryLocation.None,
ResourceDictionaryL<|endoftext|> | fim | xM4ddy/OFGB | csharp |
<|fim_prefix|>using Microsoft.Win32;
using System;
using System.Windows;
using System.Windows.Interop;
using System.Runtime.InteropServices;
using System.Windows.Controls;
using System.Security.Principal;
namespace OFGB
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public p... | fim | xM4ddy/OFGB | csharp |
<|fim_prefix|># Copyright 2024 X.AI Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | fim | xai-org/grok-1 | python |
<|fim_suffix|>
inputs = jnp.reshape(inputs, (-1, shape[-1]))
@functools.partial(
shard_map,
mesh=self.mesh,
in_specs=(self.sharding, self.sharding),
out_specs=self.sharding,
check_rep=False,
)
... | fim | xai-org/grok-1 | python |
<|fim_suffix|>rts=8,
num_selected_experts=2,
# Activation sharding.
data_axis="data",
model_axis="model",
),
)
inference_runner = InferenceRunner(
pad_sizes=(1024,),
runner=ModelRunner(
model=grok_1_model,
bs_per_dev... | fim | xai-org/grok-1 | python |
<|fim_suffix|> LanguageModelOutput:
if memory is not None:
assert active is not None
layers = []
for l in memory.layers:
# Reset steps to 0 for inactive requests to avoid unnecessary computations.
step = jnp.where(active... | fim | xai-org/grok-1 | python |
#!/usr/bin/env python3
# Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | fim | xi-editor/xi-editor | python |
#!/usr/bin/env python3
# Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | fim | xi-editor/xi-editor | python |
<|fim_suffix|> Editor Authors',
license='Apache',
packages=['xi_plugin'],
zip_safe=False)
<|fim_prefix|>from setuptool<|fim_middle|>s import setup
setup(name='xi_plugin',
version='0.1',
description='Xi editor plugin development, testing, and prototyping.',
url='https://github.com/go... | fim | xi-editor/xi-editor | python |
<|fim_prefix|>#!/usr/bin/env python3
# Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | fim | xi-editor/xi-editor | python |
<|fim_prefix|>#!/usr/bin/env python3
# Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | fim | xi-editor/xi-editor | python |
<|fim_suffix|>nse");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
... | fim | xi-editor/xi-editor | python |
<|fim_suffix|>et(100)
assert False
except IndexError:
pass
def test_prev_word():
testdata = "this is a single line\n"
cache = LineCache(len(testdata), None, 0, testdata)
assert cache.previous_word(3) == "thi"
assert cache.previous_word(8) == "is"
assert cache.previous_word(7) =... | fim | xi-editor/xi-editor | python |
<|fim_suffix|>e class for describing an edit action."""
def __init__(self, rev, insert_range, new_text, author,
priority=EDIT_PRIORITY_NORMAL, after_cursor=False):
self.rev = rev
self.start, self.end = insert_range
self.text = new_text
self.after_cursor = after_curso... | fim | xi-editor/xi-editor | python |
<|fim_prefix|># Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | fim | xi-editor/xi-editor | python |
<|fim_suffix|>sentation of a delta
# Maybe an 'Update' type or a 'Text' type or both
def update(self, view, start, end, new_len, rev, edit_type, author, text):
self.print_err("update: {}".format(view.view_id))
return PLUGIN_ACK_OK
def shutdown(self):
self.print_err("shutdown")
... | fim | xi-editor/xi-editor | python |
<|fim_prefix|># Copyright 2016 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | fim | xi-editor/xi-editor | python |
<|fim_suffix|> blue, alpha))
return (alpha << 24) | (red << 16) | (green << 8) | blue
<|fim_prefix|># Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | fim | xi-editor/xi-editor | python |
<|fim_prefix|># Copyright 2017 The xi-editor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#<|fim_suffix|>, view_id, lines):
self.view_id = view_id
self.lines = l... | fim | xi-editor/xi-editor | python |
#! /usr/bin/env python3
"""
size_compare.py
Compare the compiled size of two revisions.
Usage: size_compare.py [-h|--help] [target_ref] [base_ref]
if no arguments are passed, compares HEAD to master.
if just `target_ref` is set, compares HEAD to `target_ref`
if `base_ref` is set, compares `target_ref` to `base_ref`... | fim | xi-editor/xi-editor | python |
<|fim_suffix|>_line(&text, i);
}
})
}
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/li... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> "replace_status",
&json!({
"view_id": view_id,
"status": replace,
}),
);
}
/// Ask front-end to measure widths of strings.
pub fn measure_width(&self, reqs: &[WidthReq]) -> Result<WidthResponse, xi_rpc::Error> {
le... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>et out = self.collate();
let items: T = serde_json::from_value(out.into()).unwrap();
let source = self;
Config { source, items }
}
/// Walks the tables in priority order, returning the first
/// occurance of `key`.
fn get<S: AsRef<str>>(&self, key: S) -> Option<&Va... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> if let Some(core) = self.upgrade() {
core.inner().plugin_request(ctx, view_id, plugin_id, cmd)
} else {
Err(RemoteError::custom(0, "core is missing", None))
}
}
}
#[cfg(test)]
/// Returns a non-functional `WeakXiRef`, needed to mock other types.
pub fn dummy... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2020 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>f,
view: &View,
transform_function: F,
) {
let delta = edit_ops::change_number(&self.text, view.sel_regions(), transform_function);
if !delta.is_identity() {
self.this_edit_type = EditType::Other;
self.add_delta(delta);
}
}
pub(c... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>if only a part of a number is in a region, the whole number will be changed
ctx.do_edit(EditNotification::MoveToEndOfDocument);
ctx.do_edit(EditNotification::DeleteToBeginningOfLine);
ctx.do_edit(EditNotification::Insert { chars: "this is a 1000 text example".into() });
ctx... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>prev_path, OPEN_FILE_EVENT_TOKEN);
} else if self.file_info[&id].has_changed {
return Err(FileError::HasChanged(path.to_owned()));
} else {
let encoding = self.file_info[&id].encoding;
try_save(path, text, encoding, self.get_info(id))
.ma... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>(NEEDS_FETCH, _) => Err(ValueError::NeedsFetch),
(status, _) => Err(ValueError::LedgerFail(status)),
}
}
/// Ledger page ids are exactly 16 bytes, so we need a way of determining
/// a unique 16 byte ID that won't collide based on some data we have
pub fn gen_page_id(input_data: &[u8]) -> [u8... | fim | xi-editor/xi-editor | rust |
// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|><W: Write> {
container_ref: BufferContainerRef<W>,
chan: Receiver<SyncMsg>,
}
impl<W: Write + Send + 'static> SyncUpdater<W> {
pub fn new(container_ref: BufferContainerRef<W>, chan: Receiver<SyncMsg>) -> SyncUpdater<W> {
SyncUpdater { container_ref, chan }
}
/// Run this in a... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>yle_map = style_map.borrow();
let highlighter = style_map.get_highlighter();
let mut new_styles = Vec::new();
for stack in stacks {
let mut last_style: Option<StyleModifier> = None;
let mut upper_bound_of_last = stack.len() as usize;
// walk ba... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2016 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> clean = false;
break;
}
line_num += span.n;
}
if clean {
return;
}
let mut b = Builder::new();
let mut line_num = 0;
for span in &self.spans {
if start > line_num {
b.ad... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> }
Some(x) if bytes[x] == b'\n' => Ok(Some(LineEnding::Lf)),
Some(_) => Err(MixedLineEndingError),
_ => Ok(None),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn crlf() {
let result = LineEnding::parse_chunk("\r\n");
... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> fn offset_of_line(&self, text: &Rope, line: usize) -> usize {
self.offset_of_visual_line(text, line)
}
fn line_of_offset(&self, text: &Rope, offset: usize) -> usize {
self.visual_line_of_offset(text, offset)
}
}
<|fim_prefix|>// Copyright 2020 The xi-editor Authors.
//
// ... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>e_ranges(ivs: &[Interval]) -> Vec<Range<usize>> {
ivs.iter().map(|iv| iv.start..iv.end).collect()
}
#[test]
fn update_frontier() {
let mut lines = Lines::default();
lines.add_task(0..1000);
lines.update_tasks_after_wrap(0..10);
lines.update_tasks_after_... | fim | xi-editor/xi-editor | rust |
// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>ation(
"initialize",
&json!({
"plugin_id": self.id,
"buffer_info": info,
}),
)
}
pub fn shutdown(&self) {
self.peer.send_rpc_notification("shutdown", &json!({}));
}
// TODO: rethink naming, does this need... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>on<usize> {
let text = text.borrow();
match self {
TextUnit::Utf8 => {
if offset > text.len() {
None
} else {
text.at_or_prev_codepoint_boundary(offset)
}
}
TextUnit:... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2016 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>r(3, 5));
assert_eq!(s.regions_in_range(0, 1), &[]);
assert_eq!(s.regions_in_range(0, 2), &[]);
assert_eq!(s.regions_in_range(0, 3), &[r(3, 5)]);
assert_eq!(s.regions_in_range(0, 4), &[r(3, 5)]);
assert_eq!(s.regions_in_range(5, 6), &[r(3, 5)]);
assert_eq!(s... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> can move on.
if self.contains_theme(theme_name) && self.get_theme_name() != theme_name {
return Ok(());
}
// If we haven't loaded the theme before, we try to load it from the dump if a dump
// exists or load it from the theme file itself.
let theme_p = ... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>() {
let ld_rust = LanguageDefinition {
name: LanguageId::from("Rust"),
extensions: vec![String::from("rs")],
scope: String::from("source.rust"),
first_line_match: None,
default_config: None,
};
let ld_commit_msg = Languag... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2016 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>.selection))
.min_by_key(|x| match reverse {
true if x.end > cur_end => 2 * text.len() - x.end,
true => cur_end - x.end,
false if x.start < cur_start => x.start + text.len(),
false => x.start - cur_start,
});
... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2018 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>oncrete widths using the provided [`WidthMeasure`].
/// On success, the tokens given by `request` will resolve in the cache.
pub fn resolve_pending<T: WidthMeasure + ?Sized>(
&mut self,
handler: &T,
) -> Result<(), xi_rpc::Error> {
// The 0.0 values should all get repla... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|> prop_after = self.inner.next_codepoint().map(get_word_property);
}
self.inner.set(end);
(start, end)
}
}
#[derive(PartialEq, Eq)]
enum WordBoundary {
Interior,
Start, // a boundary indicating the end of a word
End, // a boundary indicating the start of... | fim | xi-editor/xi-editor | rust |
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>encher) {
b.iter(|| my_number(test::black_box(TEST_STR.as_bytes())))
}
}
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of ... | fim | xi-editor/xi-editor | rust |
pub mod plaintext;
pub mod rust;
<|endoftext|> | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>nder the License.
use crate::parser::Parser;
use crate::statestack::{Context, State};
use crate::ScopeId;
const PLAINTEXT_SOURCE_SCOPE: &[&str] = &["source.plaintext"];
pub struct PlaintextParser {
scope_offset: Option<u32>,
ctx: Context<()>,
}
impl PlaintextParser {
pub fn new() -> Plaint... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>Alt(Ref(p), Ref(sep)))).p(s)
}
}
fn positive_nondecimal(s: &[u8]) -> Option<usize> {
(
b'0',
Alt3(
(b'x', OneOrMoreWithSep(OneByte(is_hex_digit), b'_')),
(b'o', OneOrMoreWithSep(Inclusive(b'0'..b'7'), b'_')),
(b'b', OneOrMoreWithSep(Alt(b'0', b'... | fim | xi-editor/xi-editor | rust |
<|fim_suffix|>ing permissions and
// limitations under the License.
//! Library export for benchmarking and testing purposes.
// At the moment, we only export the peg module; this may expand.
pub mod peg;
<|fim_prefix|>// Copyright 2017 The xi-editor Authors.
//
// Licensed under the Apache License, Version 2.0 (the ... | fim | xi-editor/xi-editor | rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.