Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove needless into_iter() #134

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

### Features/Changes

### Bug Fixes
- Fix markdown syntax highlighting

## 0.4.1

### Features/Changes
- Add fedora builds
- Finish tree sitter dynamic libary support by downloading from https://github.com/lapce/tree-sitter-grammars
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ path = "lapce-proxy/src/bin/lapce-proxy.rs"
members = ["lapce-app", "lapce-proxy", "lapce-rpc", "lapce-core"]

[workspace.package]
version = "0.4.0"
version = "0.4.1"
edition = "2021"
rust-version = "1.77.0"
license = "Apache-2.0"
Expand Down
8 changes: 8 additions & 0 deletions defaults/dark-theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ dim-text = "#5C6370"
"variable.other.member" = "$red"
"tag" = "$blue"

"markup.heading" = "$red"
"markup.bold" = "$orange"
"markup.italic" = "$orange"
"markup.list" = "$orange"
"markup.link.url" = "$blue"
"markup.link.label" = "$purple"
"markup.link.text" = "$purple"

"bracket.color.1" = "$blue"
"bracket.color.2" = "$yellow"
"bracket.color.3" = "$purple"
Expand Down
8 changes: 8 additions & 0 deletions defaults/light-theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ dim-text = "#A0A1A7"
"variable.other.member" = "$red"
"tag" = "$blue"

"markup.heading" = "$red"
"markup.bold" = "$orange"
"markup.italic" = "$orange"
"markup.list" = "$orange"
"markup.link.url" = "$blue"
"markup.link.label" = "$purple"
"markup.link.text" = "$purple"

"bracket.color.1" = "$blue"
"bracket.color.2" = "$yellow"
"bracket.color.3" = "$purple"
Expand Down
2 changes: 1 addition & 1 deletion extra/linux/dev.lapce.lapce.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
</screenshot>
</screenshots>
<releases>
<release version="0.4.0" date="2024-04-24"/>
<release version="0.4.1" date="2024-08-07"/>
</releases>
</component>
2 changes: 1 addition & 1 deletion extra/macos/Lapce.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4.0</string>
<string>0.4.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
2 changes: 1 addition & 1 deletion extra/windows/wix/lapce.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="windows-1252"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Name="Lapce" Id="*" UpgradeCode="9c09a374-1135-4782-959f-2dec376a1dfa" Language="1033" Codepage="1252" Version="0.4.0" Manufacturer="Lapce">
<Product Name="Lapce" Id="*" UpgradeCode="9c09a374-1135-4782-959f-2dec376a1dfa" Language="1033" Codepage="1252" Version="0.4.1" Manufacturer="Lapce">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<Icon Id="lapce.exe" SourceFile=".\extra\windows\lapce.ico"/>
Expand Down
4 changes: 4 additions & 0 deletions lapce-app/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ pub enum LapceWorkbenchCommand {
#[strum(message = "Reveal in File Tree")]
RevealInFileTree,

#[strum(serialize = "run_in_terminal")]
#[strum(message = "Run in Terminal")]
RunInTerminal,

#[strum(serialize = "reveal_active_file_in_file_explorer")]
#[strum(message = "Reveal Active File in File Explorer")]
RevealActiveFileInFileExplorer,
Expand Down
3 changes: 2 additions & 1 deletion lapce-app/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2660,6 +2660,7 @@ impl EditorData {
Some(CommandKind::Workbench(
LapceWorkbenchCommand::PaletteCommand,
)),
Some(CommandKind::Workbench(LapceWorkbenchCommand::RunInTerminal)),
]
} else {
vec![
Expand Down Expand Up @@ -3292,7 +3293,7 @@ pub(crate) fn compute_screen_lines(
let is_right = diff_info.is_right;

let line_y = |info: VLineInfo<()>, vline_y: usize| -> usize {
vline_y - info.rvline.line_index * line_height
vline_y.saturating_sub(info.rvline.line_index * line_height)
};

while let Some(change) = changes.next() {
Expand Down
32 changes: 32 additions & 0 deletions lapce-app/src/window_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,38 @@ impl WindowTabData {
editor_data.call_hierarchy(self.clone());
}
}
RunInTerminal => {
if let Some(editor_data) =
self.main_split.active_editor.get_untracked()
{
let name = editor_data.word_at_cursor();
if !name.is_empty() {
let mut args_str = name.split(" ");
let program = args_str.next().map(|x| x.to_string()).unwrap();
let args: Vec<String> = args_str.map(|x| x.to_string()).collect();
let args = if args.is_empty() {
None
} else {
Some(args)
};

let config = RunDebugConfig {
ty: None,
name,
program,
args,
cwd: None,
env: None,
prelaunch: None,
debug_command: None,
dap_id: Default::default(),
};
self.common
.internal_command
.send(InternalCommand::RunAndDebug { mode: RunDebugMode::Run, config });
}
}
}
}
}

Expand Down
22 changes: 8 additions & 14 deletions lapce-core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ const LANGUAGES: &[SyntaxProperties] = &[
SyntaxProperties {
id: LapceLanguage::Dockerfile,
indent: Indent::space(2),
files: &["dockerfile", "containerfile"],
files: &["Dockerfile", "Containerfile"],
extensions: &["containerfile", "dockerfile"],
comment: comment_properties!("#"),
tree_sitter: TreeSitterProperties::DEFAULT,
Expand Down Expand Up @@ -1069,8 +1069,8 @@ const LANGUAGES: &[SyntaxProperties] = &[
SyntaxProperties {
id: LapceLanguage::Just,
indent: Indent::tab(),
files: &[],
extensions: &[],
files: &["justfile", "Justfile", ".justfile", ".Justfile"],
extensions: &["just"],
comment: comment_properties!(),
tree_sitter: TreeSitterProperties::DEFAULT,
},
Expand Down Expand Up @@ -1169,8 +1169,8 @@ const LANGUAGES: &[SyntaxProperties] = &[
extensions: &[],
comment: comment_properties!(),
tree_sitter: TreeSitterProperties {
grammar: Some("markdown"),
grammar_fn: None,
grammar: Some("markdown_inline"),
grammar_fn: Some("markdown_inline"),
query: Some("markdown.inline"),
code_glance: (DEFAULT_CODE_GLANCE_LIST, DEFAULT_CODE_GLANCE_IGNORE_LIST),
sticky_headers: &[],
Expand Down Expand Up @@ -1567,7 +1567,7 @@ const LANGUAGES: &[SyntaxProperties] = &[
SyntaxProperties {
id: LapceLanguage::Toml,
indent: Indent::space(2),
files: &[],
files: &["Cargo.lock"],
extensions: &["toml"],
comment: comment_properties!("#"),
tree_sitter: TreeSitterProperties::DEFAULT,
Expand Down Expand Up @@ -1683,20 +1683,14 @@ impl LapceLanguage {
}

pub fn from_path_raw(path: &Path) -> Option<LapceLanguage> {
let filename = path
.file_stem()
.and_then(|s| s.to_str().map(|s| s.to_lowercase()));
let filename = path.file_name().and_then(|s| s.to_str());
let extension = path
.extension()
.and_then(|s| s.to_str().map(|s| s.to_lowercase()));
// NOTE: This is a linear search. It is assumed that this function
// isn't called in any tight loop.
for properties in LANGUAGES {
if properties
.files
.iter()
.any(|f| Some(*f) == filename.as_deref())
{
if properties.files.iter().any(|f| Some(*f) == filename) {
return Some(properties.id);
}
if properties
Expand Down
8 changes: 8 additions & 0 deletions lapce-core/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ pub const SCOPES: &[&str] = &[
"conceal",
"none",
"tag",
"markup.bold",
"markup.italic",
"markup.list",
"markup.quote",
"markup.heading",
"markup.link.url",
"markup.link.label",
"markup.link.text",
];

pub fn line_styles(
Expand Down
2 changes: 1 addition & 1 deletion lapce.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: lapce-git
Version: 0.4.0.{{{ git_dir_version }}}
Version: 0.4.1.{{{ git_dir_version }}}
Release: 1
Summary: Lightning-fast and Powerful Code Editor written in Rust
License: Apache-2.0
Expand Down
Loading