我正在尝试使用CodeMirror 简单模式来创建我自己的编辑器并突出显示一些自定义关键字。但是,它突出显示了这些词在其他词中的出现。这是我定义编辑器模式的代码:
CodeMirror.defineSimpleMode("simple", {
// The start state contains the rules that are intially used
start: [
// The regex matches the token, the token property contains the type
{regex: /["'](?:[^\\]|\\.)*?(?:["']|$)/, token: "string"},
{regex: /;.*/, token: "comment"},
{regex: /\/\*/, token: "comment", next: "comment"},
{regex: /[-+\/*=<>!]+/, token: "operator"},
{regex: /[\{\[\(]/, indent: true},
{regex: /[\}\]\)]/, dedent: true},
//Trying to define keywords here
{regex: /\b(?:timer|counter|version)\b/gi, token: "keyword"} // gi for case insensitive
],
// The multi-line comment state.
comment: [
{regex: …
Run Code Online (Sandbox Code Playgroud) 我一直在使用Squirrel.Windows成功部署WPF一段时间了.我让我的机器重新成像,RELEAESES
文件Releases
夹中的文件是从头开始重新创建的,因为我完全在我的文件中排除了这个文件夹.gitignore
.这似乎打破了我重新映像之前创建的版本上的用户的自动更新功能.
我可以在RELEASES
文件中设置什么来强制旧版本引入更新版本而不重新创建所有nuget包吗?
这是我RELEASES
文件的相关部分.该版本的用户2.0.6121.16815
不会自动迁移到底部的较新版本.
这是我的更新程序代码app.xaml.cs
.不确定它是否相关,因为它在技术上运行良好.
Task.Run(async () =>
{
using (var mgr = new UpdateManager(updatePath, packageName))
{
var updates = await mgr.CheckForUpdate();
if (updates.ReleasesToApply.Any())
{
try
{
var lastVersion = updates.ReleasesToApply.OrderBy(x => x.Version).Last();
await mgr.DownloadReleases(updates.ReleasesToApply);
await mgr.ApplyReleases(updates);
try
{
latestExe = Path.Combine(mgr.RootAppDirectory, string.Concat("app-", lastVersion.Version), "App.exe");
log.Debug("Latest exe:" + latestExe);
mgr.CreateShortcutsForExecutable(latestExe, DefaultLocations, false);
}
catch(Exception ex)
{
log.Error("error creating shortcuts for executable",ex);
}
restart = true;
}
catch(Exception …
Run Code Online (Sandbox Code Playgroud) 我在 docker 容器内运行节点应用程序无法让 VS 代码调试器命中断点。
docker 容器公开端口 5859。在容器内,节点应用程序使用以下命令运行:
nodemon -L --watch src --exec babel-node src/server.js -- --inspect=0.0.0.0:5859 --nolazy
它报告调试器正在侦听:
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /app/src/**/*
[nodemon] starting `babel-node src/server.js --inspect=0.0.0.0:5859 --nolazy`
Debugger listening on ws://0.0.0.0:5859/5939f6b6-5ade-4ce5-9694-7df5f5b8385b
For help, see: https://nodejs.org/en/docs/inspector
Run Code Online (Sandbox Code Playgroud)
当我在 VS Code 中启动调试配置文件时,它似乎附加了。以下是正在运行的 docker 容器的日志中的一行。
但是,当我设置断点时,没有遇到断点。这是 babel 节点问题吗?是否有任何建议的路径可以让节点调试工作
babel-node
?
我的 VS Code 调试配置:
{
"type": "node",
"request": "attach",
"name": "Docker: GraphQL",
"port": 5859,
"protocol": "inspector",
"restart": true,
"remoteRoot": …
Run Code Online (Sandbox Code Playgroud) type
给定一个具有公共字段和的联合类型fedBy
。我想编写一个函数,它接受 anAnimal
作为类型,第二个参数具有该动物特有的参数。我可以让签名和推理工作,但在如何返回结果方面做错了。
type FeedAnimalParams =
| {
type: 'Dog'
fedBy: string
bowl: true
}
| {
type: 'Cat'
fedBy: string
fish: string
}
| {
type: 'Bird'
fedBy: string
seed: string
}
Run Code Online (Sandbox Code Playgroud)
我正在推断文字类型,提取type
属性
type Animal = FeedAnimalParams['type']
//type Animal = "Dog" | "Cat" | "Bird"
Run Code Online (Sandbox Code Playgroud)
我使用通用方法提取每种动物所需的独特字段。
type UniqueAnimalParams<T extends Animal> = Omit<Extract<FeedAnimalParams, { type: T }>, 'type' | 'fedBy'>
type FeedResult<T> = {
message: string
result: T
}
Run Code Online (Sandbox Code Playgroud)
这是我要写的函数
function feed<T extends Animal>( …
Run Code Online (Sandbox Code Playgroud) 我想我有点不知所措,但想知道是否有人能指出我正确的方向。我在 Visual Studio 2010 中创建了一个 C# 类库 (dll) 来与 MS SQL 服务器交互。当我从另一个 C# 程序调用它时,它工作正常。但是,当我尝试从 AHK 脚本调用它时,我得到“错误级别 = -4”,表明无法找到该函数。
这是我的 C# 代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace AHK_Interface
{
public class AHK_Interface
{
public string TrackUsage()
{
try
{
SqlConnection ahk_connection = new SqlConnection("Data Source=SQLServer;Initial Catalog=AHK;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False");
SqlCommand cmd;
ahk_connection.Open();
cmd = new SqlCommand("INSERT INTO AHK_USAGE(username,script_version,notes) VALUES ('TEST user','1.01','TEST NOTES')",ahk_connection);
cmd.Connection = ahk_connection;
cmd.ExecuteNonQuery();
string success_ind = "success!";
ahk_connection.Close();
return success_ind;
} …
Run Code Online (Sandbox Code Playgroud) c# ×2
autohotkey ×1
babeljs ×1
codemirror ×1
dll ×1
docker ×1
javascript ×1
node.js ×1
nodemon ×1
regex ×1
typescript ×1
wpf ×1